10.2.2 I/O Lists

In a data transfer statement, the I/O list specifies the entities whose values will be transferred. The I/O list is either an implied-do list or a simple list of variables (except for assumed-size arrays).

In input statements, the I/O list cannot contain constants and expressions because these do not specify named memory locations that can be referenced later in the program.

However, constants and expressions can appear in the I/O lists for output statements because the compiler can use temporary memory locations to hold these values during the execution of the I/O statement.

If an input item is a pointer, it must be currently associated with a definable target; data is transferred from the file to the associated target. If an output item is a pointer, it must be currently associated with a target; data is transferred from the target to the file.

If an input or output item is an array, it is treated as if the elements (if any) were specified in array element order. For example, if ARRAY_A is an array of shape (2,1), the following input statements are equivalent:

  READ *, ARRAY_A
  READ *, ARRAY_A(1,1), ARRAY_A(2,1)
However, no element of that array can affect the value of any expression in the input list, nor can any element appear more than once in an input list. For example, the following input statements are invalid:
  INTEGER  B(50)
  ...
  READ *, B(B)
  READ *, B(B(1):B(10))
If an input or output item is an allocatable array, it must be currently allocated.

If an input or output item is a derived type, the following rules apply:

The following sections describe simple list items in I/O lists, and implied-do lists in I/O lists.


Previous Page Next Page Table of Contents