COBOL Manual for TNS and TNS/R Programs
Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs—522555-006
9-183
READ for Sequential or Dynamic Access
The possible I-O status codes that result from successful read operations are:
If, at the start of the read operation, the file position indicator is at the end-of-file
mark or its value is not defined, execution of the READ statement is unsuccessful,
and the file-status data item is set to a value other than “00.”
The possible I-O status codes that result from unsuccessful read operations are:
I-O Status Code Successful Read Operation
“00” The read operation was unconditionally successful.
“02” This is possible only when a file has the INSERTIONORDER
attribute. The key value for the alternate key that is serving as the
current key of reference is equal to the value of that same key in
the record that is the next one in the file with respect to that key of
reference.
“04” The file is not described as having variable-length records (by
having the RECORD CONTAINS rec-1 TO rec-2
CHARACTERS clause or a RECORD VARYING clause in its file
description), and a record was read that was shorter than the
maximum size. The execution of the READ statement is
successful.
“97” A locked record was read successfully. (You must have called
SETMODE to allow locked records to be read.)
Note. After an unsuccessful execution of a READ statement, these values are
unpredictable:
•
The value of the file position indicator
•
The contents of the current record area
•
The key of reference
Any key value found in the current record area: that is, the value of the current key for
indexed files or the value of the alternate key for any type of file-system file, because in
HP COBOL sequential and relative files can have alternate keys.
I-O Status Code Unsuccessful Read Operation
“10” The end of file condition arose either in the normal course of events
or because the program tried to read an optional file that was not
present.
“30” A permanent error exists.
“46” The value of the file position indicator is undefined at the beginning
of the execution of a READ statement.
“47” The file is not open in the INPUT or I-O mode.
“90” A logic error has occurred that is not covered by the “4x” file status
codes, and no recovery is possible.
“91” The file being read is a file in EDIT format, and some step in the
read operation failed due to non-COBOL causes. The record is not
read, and the execution of the READ statement is unsuccessful.