The list-directed sequential READ statement performs the following operations:
The external records from which list-directed READ statements read data contain a sequence of values and value separators. A value in one of these records can be any one of the following:
A numeric list element can correspond only to a numeric constant, and a character list element can correspond only to a character constant. If the data types of a numeric list element and its corresponding numeric constant do not match, conversion is performed according to the rules for arithmetic assignment (see Figure 3-1).
A complex constant has the form of a pair of real or integer constants separated by a comma and enclosed in parentheses. Spaces can occur between the opening parenthesis and the first constant, before and after the separating comma, and between the second constant and the closing parenthesis.
A logical constant represents true or false values: .TRUE. or any value beginning with T, .T, t, or .t; or .FALSE. or any value beginning with F, .F, f, or .f.
A character constant must be delimited by apostrophes. An apostrophe (') within a character constant is represented by two consecutive apostrophes.
Hollerith and bit constants are not permitted.
A record can use any one of the following entities as a value separator, with or without surrounding spaces or tabs:
A slash (/) terminates processing of the input statement and the record, leaving all remaining I/O list elements unchanged.
When any of the preceding entities appear in a character constant, they are considered part of the constant, not value separators.
The end of a record is equivalent to a space character except when it occurs in a character constant. In this case, the end of the record is ignored, and the character constant is continued with the next record (the last character in the previous record is immediately followed by the first character of the next record).
Spaces at the beginning of a record are ignored unless they are part of a character constant continued from the previous record. In this case, the spaces at the beginning of the record are considered part of the constant.
Each input statement reads one or more records as required to satisfy the I/O list. If a slash separator occurs or the I/O list is exhausted before all of the values in a record are used, the remainder of the record is ignored.
Consider a program unit with the following statements:
CHARACTER*14 C DOUBLE PRECISION T COMPLEX D,E LOGICAL L,M READ (1,*) I,R,D,E,L,M,J,K,S,T,C,A,B
The following external record is read:
4 6.3 (3.4,4.2), (3, 2 ) , T,F,,3*14.6 ,'ABC,DEF/GHI''JK'/
Upon execution of the program unit, the following values are assigned to the I/O list elements:
I/O List Element | Value |
---|---|
I | 4 |
R | 6.3 |
D | (3.4,4.2) |
E | (3.0,2.0) |
L | .TRUE. |
M | .FALSE. |
K | 14 |
S | 14.6 |
T | 14.6D0 |
C | ABC,DEF/GHI'JK |
A, B, and J are unchanged.