### 7.2.2.1 Formatted Direct Access READ Statement

The formatted direct access READ statement performs the following operations:

- It reads character data from one or more external records accessed under the direct mode of access.

- It translates the data from character to binary form by using format specifications to provide editing.

- It assigns the translated data to the elements in the I/O list in the left-to-right order in which the elements appear.

If the I/O list and formatting do not use all of the characters in a record, the remainder of the record is discarded. If the I/O list and formatting require more characters than are contained in the record, the remaining fields are read as spaces.

Example

In the following example, the READ and FORMAT statements read the first 10 fields from record 35 in the file connected to logical unit 2, translate the values to binary form, and then assign the translated values to the internal storage locations of the 10 elements of the array NUM.

          READ (2,REC=35,FMT=10) (NUM(K),  K=1,10)

    10    FORMAT (10I2)

Previous Page Next Page Table of Contents