Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

I-O status

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 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.

02

A record was read with ALTERNATE KEY and subsequent sequential reading with the same key has found at least one record with an identical key.

A record was written with ALTERNATE KEY WITH DUPLICATES and there is already a record with an identical key value for at least one alternate key.

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 the given file.

05

An OPEN statement was executed for an OPTIONAL file which does not exist.


Execution unsuccessful: at end condition

10

An attempt was made to execute a sequential READ operation. However, no next logical record was available, as the end-of-file was encountered.


Execution unsuccessful: invalid key condition

21

File sequence error in conjunction with ACCESS MODE IS SEQUENTIAL:

  1. The record key value was changed between the successful execution of a READ statement and the execution of the next REWRITE statement for a file, or

  2. the ascending sequence of record keys was violated in successive WRITE statements.

22

Duplicate key
An attempt was made to execute a WRITE statement with a primary key for which there is already a record in the indexed file.

An attempt was made to create a record with ALTERNATE KEY, but without WITH DUPLICATES, and there is already an alternate key with the same value in the file.

23

Record not located
An attempt was made (using a READ, START, DELETE or REWRITE statement with key) to access a record not containing in the file.

24

Boundary values exceeded
An attempt was made to execute a WRITE statement beyond the system-defined boundaries of an indexed file (see "COBOL2000 User Guide" [1]).


Execution unsuccessful: unrecoverable error

30

No further information regarding the I-O operation is available (the DMS code provides further information).

35

An OPEN statement with the INPUT, I-O or EXTEND phrase was issued for a non-optional file which does not exist.

37

OPEN statement on a file that cannot be opened due to the following violations:

  1. OPEN OUTPUT/I-O/EXTEND on a write-protected file(password, RETPD in catalog, ACCESS=READ in catalog)

  2. OPEN INPUT on a read-protected file (password)

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:

  1. One or more of the operands ACCESS-METHOD, RECORD-FORMAT, RECORD-SIZE or KEY-LENGTH were specified in the ADD-FILE-LINK command with values that conflict with the corresponding explicit or implicit program specifications.

  2. Record length error occurred for an input file (catalog check, if RECFORM=F).

  3. The record size is greater than the BLKSIZE entry in the catalog of an input file.

  4. The catalog entry of one of the FCBTYPE, RECFORM, RECSIZE (if RECFORM=F), KEYPOS, or KEYLEN operands for an input file is in conflict with the corresponding explicit or implicit program specifications or with the corresponding specifications in the ADD-FILE-LINK command.

  5. An attempt was made to open a file whose alternate key does not match the key values specified in the ALTERNATE RECORD KEY clause in the program.


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

For ACCESS MODE IS SEQUENTIAL:
The most recent I-O statement executed prior to a DELETE or REWRITE statement was not a successfully executed READ statement.

44

Record length limits exceeded:
An attempt was made to execute a WRITE or REWRITE statement. However, the length of the record is outside the range allowed for this file.

46

An attempt was made to execute a sequential READ statement for a file in INPUT or I-O mode. However, no valid next record is available since:

  1. the preceding START statement was unsuccessful, or

  2. the preceding READ statement was unsuccessful without leading to an at end condition, or

  3. an attempt was made to execute a READ statement after the at end condition was encountered.

47

An attempt was made to execute a READ or START statement for a file that is not open in INPUT or I-O mode.

48

An attempt was made to execute a WRITE statement for a file that is not in OUTPUT, I-O or EXTEND mode.

49

An attempt was made to execute a DELETE or REWRITE statement for a file that is not in I-O mode.


Other conditions with unsuccessful execution

90

System error; no further information regarding the cause is available.

91

OPEN error: the actual cause is evident from the DMS code (see "section FILE STATUS clause" specifying data-name-2).

93

For shared update processing only (see "COBOL2000 User Guide" [1], "Shared updating of files"): The I-O statement could not terminate normally because a different task is accessing the same file, and the access operations are incompatible:

94

For shared update processing only (see "COBOL2000 User Guide" [1], "Shared updating of files"):

  1. deviation from call sequence READ - REWRITE/DELETE.

  2. The record size is greater than the block size.

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.

96

READ PREVIOUS is not supported for a module compiled with COBRUN ENABLE-UFS-ACCESS=YES.