A simple I/O list element can be a scalar reference, scalar array name reference, or aggregate reference; for example:
WRITE (6,10) J, K(3), 4, (L+4)/2, N
When you use an array name reference or an aggregate reference in an I/O list, an input statement reads enough data to fill every element of the array or aggregate. An output statement writes all of the values in the array or aggregate.
Data transfer begins with the initial element of the array and proceeds in the order of subscript progression, with the leftmost subscript varying most rapidly; for example, the following statement defines a two-dimensional array:
DIMENSION ARRAY(3,3)
If the name ARRAY, with no subscripts, appears in a READ statement, that statement assigns values from the input record(s) to ARRAY(1,1), ARRAY(2,1), ARRAY(3,1), ARRAY(1,2), and so on through ARRAY(3,3).
In an input statement, variables in the I/O list can be used in array subscripts later in the list; for example:
READ (1,1250) J, K, ARRAY(J,K) 1250 FORMAT (I1,1X,I1,1X,F6.2)
The input record contains the following values:
1,3,721.73
When the READ statement is executed, the first input value is assigned to J and the second to K, thereby establishing the actual subscript values for ARRAY(J,K). Then the value 721.73 is assigned to ARRAY(1,3). Variables that are to be used as subscripts in this way must appear before (to the left of) their use as the array subscripts in the I/O list.
An output statement I/O list can contain any valid expression. However, this expression must not attempt any further I/O operations on the same logical unit. For example, an output statement I/O list expression must not refer to a function subprogram that performs I/O on the same logical unit.
An input statement I/O list must not contain a constant or an
expression, except as a subscript expression in an array reference
or as an expression in a substring reference.
Use aggregate references only in unformatted input and output
statements.
For details on scalar, array name, and aggregate references, see Section 2.2.6.