The I-O status is a value that can be used in a COBOL program to check the status of an input/output operation. In order to do this, the FILE STATUS clause must be specified in the FILE CONTROL paragraph of the ENVIRONMENT DIVISION.
The I-O status value is transferred to a two-character data item
during the execution of a CLOSE, OPEN, READ, REWRITE, or WRITE statement,
prior to the execution of any associated imperative statement, and
prior to the execution of any corresponding USE AFTER STANDARD EXCEPTION procedure.
The table below shows the I-O status values and their meanings:
I-O status | Meaning |
Execution successful | |
00 | The I-O statement terminated normally. No further information regarding the I-O operation is available. |
04 | Record length conflict: A READ statement terminated normally. However, the length of the record read lies outside the limits defined in the record description entry for this file. |
05 | Successful execution of an OPEN INPUT/I-O/EXTEND on a file; however, the referenced file indicated by the OPTIONAL phrase was not present at the time the OPEN statement was executed. |
07 |
|
Execution unsuccessful: at end condition | |
10 | An attempt was made to execute a READ statement. A sequential READ statement with the OPTIONAL phrase was attempted for the first time on a nonexistent file. |
Execution unsuccessful: unrecoverable error | |
30 |
|
34 | An attempt was made to write outside the sequential file boundaries set by the system. |
35 | An OPEN statement with the INPUT/I-O/EXTEND phrase was attempted on a nonexistent file. |
37 | OPEN statement on a file that cannot be opened in any of the following ways:
|
38 | An attempt was made to execute an OPEN statement for a file previously closed with the LOCK phrase. |
39 | The OPEN statement was unsuccessful as a result of one of the following conditions:
|
Execution unsuccessful: logical error | |
41 | An attempt was made to execute an OPEN statement for a file which was already open. |
42 | An attempt was made to execute a CLOSE statement for a file which was not open. |
43 | While accessing a disk file opened with OPEN I-O, the most recent I-O statement executed prior to a REWRITE statement was not a successfully executed READ statement. |
44 | Boundary violation:
|
46 | An attempt was made to execute a READ statement for a file in INPUT or I-O mode. However, there is no valid next record since:
|
47 | An attempt was made to execute a READ statement for a file not in INPUT or I-O mode. |
48 | An attempt was made to execute a WRITE statement for a file not in OUTPUT or EXTEND mode. |
49 | An attempt was made to execute a REWRITE statement for a file not open in I-O mode. |
Other conditions with unsuccessful execution | |
90 | System error; no further information available regarding the cause. |
91 | System error; a system call terminated abnormally; either an OPEN error or no free device; the actual cause is evident from the DMS code (see section "FILE STATUS clause") |
95 | The specifications in the BLOCK-CONTROL-INFO or BUFFER-LENGTH operands of the ADD-FILE-LINK command are not consistent with the file format, the block length, or the format of the volume being used. |