READ statement

The READ statement performs RANDOM access to INDEXED and RELATIVE VSAM files.

Syntax

Read syntax diagramSkip visual syntax diagramREAD&FILEKEY&FIELD' &LITERAL'HOLDNOHOLDSTATUS

Parameters

&FILE
The name of the input file to be read
&FIELD
A field name that contains the file key to be read
&LITERAL
A literal that identifies a record on the file
HOLD
Protects the record from a concurrent update
NOHOLD
Does not protect the record from a concurrent update.
STATUS
Specify if you want to test for a successful I/O. Normally, zero in the file status indicates a successful I/O and a non-zero indicates an I/O error.

HOLD and NOHOLD are not supported by Migration Utility. Such amenities can be accomplished via JCL DISP= parameter and VSAM SHARE options.

The &FIELD is normally a working storage field or a field in another file. The contents of the &FIELD must be established before READ is issued.

You can use file presence (IF &FILE) to ensure a successful read.