The READ statement allows data to be read from files and assigned to program variables.
| Note: | The syntax of the READ statement and the syntax of the WRITE statement are nearly identical. Differences in the semantics are discussed following the syntax for each statement. |
<read statement>
── READ ── ( ─┬─<file part>─┬───────────────────────────────┬─ ) ──────►
│ └─<format and list part>────────┤
└─<core-to-core part>──<format and list part>─┘
►─┬───────────────────────────────────┬────────────────────────────────┤
└─<action labels or finished event>─┘The action of the READ statement depends on the form of the <file part> element or <core-to-core part> element and on the form of the <format and list part> element. If the file was declared as a direct file, the <record number or carriage control> part interpretation is governed in ways specific to the device type; this is less general than for nondirect files.
The file part or the core-to-core part specifies the location of the data to be read.
The READ statement can be used as a Boolean function. You cannot use a READ statement inside another file I/O statement. When the read operation fails, the value TRUE is returned. When the read operation succeeds, the value FALSE is returned. The READ statement returns a value identical to that returned by the file attribute STATE. For more information, refer to the discussion of the STATE attribute in the File Attributes Programming Reference Manual.

