COBOL Manual for TNS and TNS/R Programs
Procedure Division
HP COBOL Manual for TNS and TNS/R Programs—522555-006
8-28
Input-Output
Input-Output
These topics are common to several input-output statements:
•
I-O Status Code
•
Diagnosing Input-Output Errors
•
Recovering from Input-Output Errors
•
Timed Input and Output
I-O Status Code
Each file-control entry can include a FILE STATUS clause that designates a 2-
character file-status data item declared elsewhere in the program as the receptacle for
that file’s I-O status code. The leftmost character position of the file-status data item is
Status Key 1. The rightmost character position of the file-status data item is Status Key
2.
Whenever a program executes a CLOSE, DELETE, LOCKFILE, OPEN, READ,
REWRITE, START, UNLOCKFILE, UNLOCKRECORD, or WRITE statement for a file
that has a FILE STATUS clause, the run-time routines record the I-O status code in the
specified file-status data item. The storage operation occurs prior to the execution of
any applicable USE procedure or any applicable imperative statement associated with
the input-output statement (in AT END, NOT AT END, INVALID KEY, or NOT INVALID
KEY phrases).
The I-O status code indicates the success or failure of the input-output statement, and
(if failure), the reason for the failure. Table 8-6 through Table 8-11 show the possible
values of the file-status data item.
Topics:
•
Status Key 1
•
Status Key 2