The I/O statements fall into three groups:
All these statements have a similar general form (except that only
the READ and WRITE statements can have a data-transfer
READ( control-list ) input-list
WRITE( control-list ) output-list
The items in each list are separated by commas. Those in the control list are usually specified by keywords, in which case the order does not matter, although it is conventional to have the unit identifier first. For compatibility with Fortran66, if the unit identifier does come first then the keyword UNIT= may be omitted. Furthermore, when this keyword is omitted in READ and WRITE statements and the format identifier is second its keyword may also be omitted. Thus these two statements are exactly equivalent:
READ(UNIT=1, FMT=*, ERR=999) AMPS, VOLTS, HERTZ READ(1, *, ERR=999) AMPS, VOLTS, HERTZUse of this abbreviated form is a matter of taste: for the sake of clarity the keywords will all be shown in other examples.
Many of the keywords in the control-list can take a character expression as an argument: in such cases any trailing blanks in the value will be ignored. This makes it easy to use character variables to specify file names and characteristics.
There is one general restriction on expressions used in all I/O statements: they must not call external functions which themselves execute further I/O statements. This restriction avoids the possibility of recursive calls to the I/O system.