FORTRAN Reference Manual

Statements
FORTRAN Reference Manual528615-001
7-89
READ Statement
input-list
is a list of items separated by commas. A list item is either the name of a variable,
an array, an array element, a character substring, a RECORD, a RECORD field, or
an implied DO list.
read-spec
is one of the following control specifiers. You can write these specifiers in any order
unless you omit the UNIT or FMT keywords; for more information, see
Considerations on page 7-91.
[UNIT=] unit
unit is one of the following:
°
An integer expression from 1 through 999 that corresponds to a unit
previously connected by an OPEN statement or to a preconnected unit.
°
An asterisk (*), which implies unit 5. Unit 5 is preconnected for formatted
sequential input.
°
An internal file identifier.
If you omit the UNIT keyword, unit must be the first entry in the list.
For information about external and internal files, see External and Internal Files
on page 5-3.
[FMT=] format
See the format on page 7-86
If you use an asterisk to indicate list-directed formatting, you cannot use a
record specifier in the control list.
If you omit the optional FMT keyword, format must be the second item on the
control list and unit, without the UNIT specifier, must be the first item on the
list.
REC = rec
rec is an expression of INTEGER*2 or INTEGER*4 type that specifies the
record number of the record to read.
IOSTAT = ios
ios is an integer variable or integer array element in which FORTRAN returns
an error number if an error occurs while executing the READ statement. If the
READ statement is successful, ios is zero. If the READ statement encounters
an end of file, ios is -1. For more information about error numbers, see the
Error Numbers on page 6-5.