



For sequential access, the READ statement makes the next logical 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.
___ Format 1--Sequential Retrieval _____________________________________
| |
| >>__READ__file-name-1__ _______________ __ ________ _________________> |
| |_NEXT__________| |_RECORD_| |
| | (1)| |
| |_ PREVIOUS ____| |
| |
| >__ ____________________ ____________________________________________> |
| |_INTO__identifier-1_| |
| |
| >__ _____________________________________ ___________________________> |
| |_ ____ __END__imperative-statement-1_| |
| |_AT_| |
| |
| >__ __________________________________________ __ __________ _______>< |
| |_NOT__ ____ __END__imperative-statement-2_| |_END-READ_| |
| |_AT_| |
| |
| Note: |
X | (1) PREVIOUS is only supported on AIX, OS/2, and Windows. |
| |
|________________________________________________________________________|
___ Format 2--Random Retrieval _________________________________________
| |
| >>__READ__file-name-1__ ________ __ ____________________ ____________> |
| |_RECORD_| |_INTO__identifier-1_| |
| |
| >__ __________________________ ______________________________________> |
| |_KEY__ ____ __data-name-1_| |
| |_IS_| |
| |
| >__ __________________________________________ ______________________> |
| |_INVALID__ _____ __imperative-statement-3_| |
| |_KEY_| |
| |
| >__ ______________________________________________ __ __________ ___>< |
| |_NOT INVALID__ _____ __imperative-statement-4_| |_END-READ_| |
| |_KEY_| |
| |
|________________________________________________________________________|
>_Host_> Under OS/390 and VM, you must specify the NEXT RECORD phrase for files in dynamic access mode, which are retrieved sequentially. <_Host_<
The result of the execution of a READ statement with the INTO phrase is equivalent to the application of the following rules in the order specified:
Subtopics:
© Copyright IBM Corp. 1991, 1998
Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.