HP Fortran Programmer's Reference (September 2007)

I/O formatting
Format specification and I/O data list
Chapter 9266
Format specification and I/O data list
A formatted I/O statement references each item in an I/O list, and the corresponding format
specification is scanned to find a format descriptor for each item. As long as an item is
matched to an edit descriptor, normal execution continues.
If there are more edit descriptors than list items, format control terminates with the last list
item. If there are fewer edit descriptors than list items, the following three steps are
performed:
1. The current record is terminated.
2. A new record is started.
3. Format control is returned to the format specification based upon the following hierarchy:
a. Control returns to the repeat specification for the rightmost group at nested level 1.
For information about nested levels, see “Nested format specifications” on page 265.
b. If no repeat specification exists in the rightmost group at nested level 1, control
returns to the group itself.
c. If there is no group at nested level 1, control returns to the first descriptor in the
format specification.
Table 9-25 provides examples showing how control is returned to the format specification in
different circumstances.
Table 9-25 Format control and nested format specifications
Format specification
Control
returns to:
Explanation
(I5,2(3X,I2,(I4))) 2(3X,I2,(I4)) The rightmost group at nested level 1 is
3X,I2,(I4). Control returns to the repeat
specifier for this group.
(F4.1,I2) (F4.1,I2) There is no group at nested level 1. Control
returns to the first descriptor in the format
specification.
(A3,(3X,I2),4X,I4) (3X,I2),4X,I4 Control returns to the group at nested level 1.