Execution proceeds as follows:
The file associated with the specified unit is determined.
The format, if specified, is established. The file is positioned appropriately prior to the data transfer.
If the input list is not empty, data is transferred from the file to the corresponding items in the list.
The items are processed in order as long as the input list is not exhausted. The next specified item is determined and the value read is transmitted to it. Data editing in formatted READ is done according to the specified format.
In the third and fourth forms of namelist-directed READ, the items of the specified namelist group are processed according to the rules of namelist-directed input.
The file is repositioned appropriately after data transfer.
If ios is specified and no error occurred, it is set to zero.
ios is set to a positive value, if an error or end of file was encountered.
If s is specified and end of file was encountered, control is transferred to s.
If s is specified and an error occurs, control is transferred to s.
There are two forms of READ:
READ f [, iolist]
READ([NML= ] grname)
The above two forms operate the same way as the others, except that reading from the keyboard is implied.
Execution has the following differences:
When the input list is exhausted, the cursor is moved to the start of the line following the input. For an empty input list, the cursor is moved to the start of the line following the input.
If an end-of-line, CR, or NL is reached before the input list is satisfied, input continues from the next line.
If an end-of-file (Control-D) is received before the input list is satisfied, input stops, and unsatisfied items of the input list remain unchanged.
If u specifies an external unit that is not connected to a file, an implicit OPEN operation is performed equivalent to opening the file with the options in the following example:
OPEN(u, FILE='FORT.u', STATUS='OLD', ACCESS='SEQUENTIAL', & FORM=fmt )
Note also:
The value of fmt is 'FORMATTED' or 'UNFORMATTED' accordingly, as the read is formatted or unformatted.
A simple unsubscripted array name specifies all of the elements of the array in memory storage order, with the leftmost subscript increasing more rapidly.
An attempt to read the record of a direct-access file that has not been written, causes all items in the input list to become undefined.
The record number count starts from one.
Namelist-directed input is permitted on sequential access files only.