For randomly accessed files, READ makes a specified record available.
Format 2 -
READ file-name RECORD [ INTO dest-item ]
[ WITH [ NO ] LOCK ]
[ REGARDLESS OF LOCK ]
[ { UPDATERS } ]
[ ALLOWING { READERS } ]
[ { NO OTHERS } ]
[ KEY IS key-data ]
[ INVALID KEY stment ] [ NOT INVALID KEY stment ]
[ END-READ ]
1 – file-name
is the name of a file described in the Data Division. It cannot be a sort or merge file.
2 – dest-item
is the identifier of a data item that receives the record accessed by the READ statement.
3 – key-data
is the data-name of a data item or the segmented-key name specified as a record key for file-name. It can be qualified. This clause is not used on RELATIVE files.
4 – stment
is an imperative statement executed for an invalid key or not invalid key condition.