Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

Dollar-Sign ($) and Backslash ( \\ ) Editing

The dollar sign and backslash edit descriptors modify the output of carriage control specified by the first character of the record. They only affect carriage control for formatted files, and have no effect on input.

If the first character of the record is a blank or a plus sign (+), the dollar sign and backslash descriptors suppress carriage return (after printing the record).

For terminal device I/O, when this trailing carriage return is suppressed, a response follows output on the same line. For example, suppose the following statements are specified:

       TYPE 100
100    FORMAT (' ENTER RADIUS VALUE ',$)
       ACCEPT 200, RADIUS
200    FORMAT (F6.2)

The following prompt is displayed:

  ENTER RADIUS VALUE

Any response (for example, "12.") is then displayed on the same line:

  ENTER RADIUS VALUE    12.

If the first character of the record is 0, 1, or ASCII NUL, the dollar sign and backslash descriptors have no effect.

Consider the following:

     CHARACTER(20) MYNAME
     WRITE (*,9000)
9000 FORMAT ('Please type your name:',\)
     READ  (*,9001) MYNAME
9001 FORMAT (A20)
     WRITE (*,9002) ' ',MYNAME
9002 FORMAT (1X,A20)

This example advances two lines, prompts for input, awaits input on the same line as the prompt, and prints the input.

The following shows the same example using Fortran standard constructs:

     CHARACTER(20) MYNAME
     WRITE (*,9000, ADVANCE='NO')
9000 FORMAT ('Please type your name:')
     READ  (*,9001) MYNAME
9001 FORMAT (A20)
     WRITE (*,9002) ' ',MYNAME
9002 FORMAT (1X,A20)