The READ statement makes a record available to the program:
- For sequential access, the READ statement makes the next record from a
file available to the object program.
- For random access, the READ statement makes a specified record from a
direct-access file available to the object program.
When the READ statement is executed, the associated file must be open in
INPUT or I-O mode. Execution of the READ statement depends on the file organization.
File organization can be:
The READ statement has five formats:
If the FILE STATUS clause is specified in the file-control entry, the associated
status key is updated when the READ statement is processed.
Following the unsuccessful processing of any READ statement, the contents
of the associated record area and the position of the file position indicator
are undefined.