HP Fortran Programmer's Reference (September 2007)

I/O formatting
Edit descriptors
Chapter 9 243
Slash (/) edit descriptor
The slash edit descriptor terminates the current record and begins processing a new record
(such as a new line on a terminal). This edit descriptor has the same result for both input and
output: it terminates the current record and begins a new one. For example, on output a
newline character is printed, and on input a new line is read.
Keep in mind the following considerations when using the slash edit descriptor:
If a series of two or more slashes are written at the beginning of a format specification, the
number of records skipped is equal to the number of slashes.
•If
n
slashes appear other than at the beginning of a format specification (where
n
is
greater than 1), processing of the current record terminates and
n
- 1 records are skipped.
If a format contains only
n
slashes (and no other format specifiers),
n
+ 1 records are
skipped.
The / edit descriptor does not need to be separated from other descriptors by commas.
Colon (:) edit descriptor
The colon edit descriptor (:) is used when performing formatted I/O to terminate format
control when the I/O list has been exhausted. If all items in an I/O list have been read or
written, the colon edit descriptor stops any further format processing. If more items remain in
the list, the colon edit descriptor has no effect.
Consider the following example:
WRITE (*, 40) 1, 2
WRITE (*, 50) 1, 2
40 FORMAT(3(' value =', I2))
50 FORMAT(3(:, ' value =', I2))
The first WRITE statement outputs the line:
value = 1 value = 2 value =
The descriptor 'value =' is repeated a third time because format control is not terminated until
the descriptor I2 is reached and not satisfied.
The second WRITE statement outputs the line:
value = 1 value = 2
This time, the colon descriptor terminates format control before the string ' value=' is
output a third time.