COBOL Manual for TNS and TNS/R Programs

Procedure Division
HP COBOL Manual for TNS and TNS/R Programs522555-006
8-33
Diagnosing Input-Output Errors
Diagnosing Input-Output Errors
The I-O status code returned to the program indicates what type of input-output error
occurred. The run-time routines send diagnostic messages for permanent error
conditions and logic error conditions to the home terminal (or designated execution-log
file), regardless of whether an error is recoverable. You must examine the I-O status
code and to determine whether an unsuccessful input-output operation must cause the
program to terminate abnormally or allow it to continue processing. To facilitate
program execution and error recovery, the COBOL run-time input-output errors are
classified as either:
Program Logic Errors
External Errors
Program Logic Errors
A program logic error is considered nonrecoverable and causes the program to
terminate abnormally after execution of any applicable declarative section. This type of
error causes I-O status code “4x ” where x is a decimal digit, or I-O status code “90”
(for errors defined by HP).
“47” The execution of a READ or START statement is attempted on a file not open in
the Input or I-O mode.
“48” The execution of a WRITE statement is attempted on a file not open in the I-O,
Output, or Extend mode.
“49” The execution of a DELETE or REWRITE statement is attempted on a file not
open in the I-O mode.
Table 8-11. Status Key 2 Values: Unsuccessful Completion—Conditions Defined
by HP
I-O
Status
Code File Exception Condition
“90” A Logic Error has occurred; it is not one of those defined under the “4xcodes,
and no recovery is possible.
“91” An I-O Error from which recovery might be possible has occurred.
Table 8-10. Status Key 2 Values: Unsuccessful Completion—Logic Error
Condition (page 2 of 2)
I-O
Status
Code File Exception Condition