IBMMainframes.com

Quick References for IBM Mainframe Programming

COBOL FILE STATUS CODES:

 

File status Codes beginning with a '0' are considered Successful Execution. Codes beginning with a '1' are considered "At End" messages, those beginning with a '2' are considered "Invalid Key" messages, File Status Codes beginning with a '3' are considered "Permanent Errors", keys like '4x' are "Logical Errors" and '9x' are "Implementer defined".

Code

 Statements   

Description of the Code

     

00

ALL

Successful completion

     

01

-

Not a valid File Status Key.

     

02

READ

WRITE

REWRITE

"DUPLICATE KEY", Indexed files only.

The input-output statement was successfully executed, but a duplicate key was detected. A duplicate key exist for at least one alternate key for which duplicates are allowed.

Possible causes:

For a READ statement, the key value for the current key is equal to the value of that same key in the next record in the current key of reference.

For a WRITE or REWRITE statement, the record just written created a duplicate key value for at least one alternate record key for which duplicates are allowed.

     

03

-

Not a valid File Status Code.

     

04

READ

"Record length Mismatch".

A READ statement was successfully executed, but the length of the record being processed did not conform to the fixed file attributes for that file. It means the size of the record just read does not agree with the size specified in the program.

     

05

OPEN

DELETE

"Missing Optional file".

An OPEN statement is successfully executed but the referenced optional file is not present at the time the OPEN statement is executed. The file has been created if the open mode is I-O or EXTEND. If this happened on a DELETE FILE then the file was not found. This does not apply to VSAM sequential files.

     

06

WRITE

Attempted to write to a file that has been opened for INPUT.

     

07

CLOSE

OPEN

"Referenced file is not on a TAPE device". Sequential files only.

For a CLOSE statement with the NO REWIND, REEL/UNIT, or FOR REMOVAL phrase or for an OPEN statement with the NO REWIND phrase, the referenced file was on a non-reel/unit medium.

     

08

READ

Attempted to read from a file opened for output.

     

09

-

No room in directory or directory does not exist.

     

10

READ

"END OF FILE".

A sequential READ statement was attempted and no next logical record existed in the file because the end of file (EOF) had been reached, or the first READ was attempted on an optional input file that was not present.

     

12

OPEN

Attempted to open a file that is already open.

     

13

READ

No next logical record (at end).

     

14

READ

Relative files only. A sequential READ statement was attempted for a relative file, and the number of significant digits in the relative record number is greater than the size specified for the relative key data item.

     

15

READ

A sequential READ statement is attempted for the first time on an optional file that is not present.

     

16

OPEN

Too many device files open. (Micro Focus only)

     

17

READ

Record error: probably zero length. (Micro Focus only)

     

18

READ

Read part record error: EOF before EOR or file open in wrong mode (Micro Focus only).

     

19

REWRITE

Rewrite error: open mode or access mode wrong (Micro Focus only).

     

20

OPEN

Device or resource busy (Micro Focus only).

     

21

DELETE

WRITE

REWRITE

"INVALID KEY", Sequentially accessed Indexed or Relative files only. Indicates a sequence error.

1) The ascending key requirements of successive record key values has been violated, or, 2) the prime record key (for an indexed file) or relative key (for a relative file) value has been changed by a COBOL program between successful execution of a READ statement and execution of the next REWRITE statement for that file. or 3) the prime record key value was not greater than that of the last record written. (Prime record key values must be in ascending order.)
 

     

22

WRITE

REWRITE

"DUPLICATE KEY", Indexed and relative files only. Indicates a duplicate key condition.

1) An attempt was made to write a record that would create a duplicate key in a relative file; or 2) an attempt was made to write or rewrite a record that would create a duplicate prime record key or 3) a duplicate alternate record key without the DUPLICATES phrase in an indexed file.

     

23

DELETE

WRITE

REWRITE

START

"RECORD NOT FOUND", Indexed and relative files only.

An attempt has been made to access a record, identified by a record key (prime or alternate for indexed file, relative key for relative files), and that record does not exist in the file. Or a START or READ operation has been tried on an optional input file that is not present.

     

24

WRITE

"BOUNDARY VIOLATION", Indexed and relative files only.

Operation failed because an attempt was made to write beyond the externally defined boundaries for an indexed or relative file; or a sequential write operation was attempted for a relative file but the number of digits in the relative key value exceeded the size specified for the relative key data item. Or Disk full.

     

25

READ

START

A START statement or a random READ statement has been attempted on an OPTIONAL file that is not present.

     

30

ALL

The I/O statement was unsuccessfully executed as the result of a boundary violation for a sequential file or as the result of an I/O error, such as a data check parity error, or a transmission error or an error that cannot be specified by other status codes.

     

32

OPEN

Too many Indexed files opened. This can also happen when a sequential file is open for input and an attempt is made to open the same file for output.  (Micro Focus only).

     

34

WRITE

SORT

"BOUNDARY VIOLATION", Sequential files only.

The I/O statement failed because of a boundary violation. This condition indicates that an attempt has been made to write beyond the externally defined boundaries of a sequential file. Or Disk full for a sequential file or sort file.

     

35

OPEN

SORT

"FILE NOT FOUND",

An OPEN operation with the I-O, INPUT, or EXTEND phrases has been tried on a non-OPTIONAL file that is not present.

     

37

OPEN

An OPEN statement was attempted on a file that would not support the open mode specified in the OPEN statement.

Possible violations are:
The EXTEND or OUTPUT phrase was specified but the file would not support write operations.
The I-O phrase was specified but the file would support the input and output operations.
The INPUT phrase was specified but the file would not support read operations.

     

38

OPEN

An OPEN operation has been tried on a file previously closed with a lock.

     

39

OPEN

The OPEN statement was unsuccessful because a conflict has been detected between the fixed file attributes and the attributes specified for the file in the program. (Attributes that are checked are organization, index keys (prime and alternate), block size, and maximum record size.)


This is usually caused by a conflict with record-length, key-length, key-position or file organization.

Other possible causes are:
1. Alternate indexes are incorrectly defined (Key length or position, duplicates or sparse parameters).
2. The Recording Mode is Variable or Fixed or not defined the same as when the file was created.
3. For files with variable-length records the minimum and maximum record lengths for the actual file may not match the minimum and maximum record lengths used by the program

     

41

OPEN

An OPEN operation has been tried on a file which is already opened.

     

42

CLOSE

A CLOSE operation has been tried on a file which is already closed (Or never opened).

     

43

DELETE

REWRITE

Sequentially accessed files only.

For relative and indexed files in the sequential access mode: The last I/O statement executed for the file, before the execution of a DELETE or REWRITE statement, was not a READ statement.

For a mass storage file in the sequential access mode: The last I/O statement executed for the file, before the execution of a REWRITE statement, was not a READ statement.

     

44

WRITE

REWRITE

"Record Size Mismatch",

An attempt was made to rewrite a record whose size is not the same as the record being replaced. Possible causes:
Attempting to WRITE or REWRITE a record that is larger than the largest, or smaller than the smallest record allowed by the RECORD IS VARYING clause of the associated file.
Attempting to REWRITE a record to a file and the record is not the same size as the record being replaced.

     

46

READ

Sequentially accessed files only.

A sequential READ operation has been tried on a file open in the INPUT or I-O mode but no valid next record has been established because:
The preceding READ statement was unsuccessful but did not cause an AT END condition
The preceding READ statement caused an AT END condition.

     

47

READ

START

A READ or START operation has been tried on a file not opened in INPUT or I-O mode.

     

48

WRITE

A WRITE operation has been tried on a file not opened in the OUTPUT, I-O, or EXTEND mode, or on a file open in the sequential access mode.

     

49

DELETE

REWRITE

An attempt was made to delete or rewrite a record of an unopen file, or of a file not open in I-O mode.

 

 

 

90

CLOSE

For multithreading only: A CLOSE of a VSAM or QSAM file was attempted on a thread that did not open the file.

 

 

 

91

OPEN

For VSAM only.  Incorrect password.
     
92 ALL For VSAM only. Logical Error, Example: opening an opened file, File already at end,  incorrect key etc.
     
93 OPEN For VSAM only. Recourse not Available, Insufficient storage, no more extents available, file already under exclusive control (may be allocated to CICS or another user)
     
94 READ For VSAM with CMPR2 compiler-option only: No file position indicator for sequential READ request.
     
95 OPEN For VSAM only.  Invalid or incomplete file information

Possibilities: Open an ESDS as a KSDS or vice versa, Attempt to open a non-loaded file as INPUT or I-O, Attempt to open a loaded file as OUTPUT, Record key length or displacement does not match catalog.

     
96 OPEN For VSAM file: An OPEN statement with the OUTPUT phrase was attempted, or an OPEN statement with the I-O or EXTEND phrase was attempted for an optional file, but no DD statement was specified for the file.


For QSAM file: An OPEN statement with the OUTPUT phrase was attempted, or an OPEN statement with the I-O or EXTEND phrase was attempted for an optional file, but no DD statement was specified for the file and CBLQDA(OFF) run-time option was specified

For VSAM under MVS: No DD statement specified for this file.

FOR VSAM and SAM under DOS/VSE: No DLBL statement specified for this file.

     
97 OPEN For VSAM only.  File not closed by previous job. OPEN statement execution successful: File integrity verified.
     
98 ALL File is Locked or Index is corrupt - Open failed due to either the invalid contents of an environment variable specified in a SELECT ... ASSIGN clause, or failed dynamic allocation.
     
99 READ

WRITE

REWRITE

DELETE

Record Locked by another user- record access failed.

 

^Note: For more references like VSAM Status Codes & CICS Abend Codes, use our MAINFRAME QUICK REFERENCES

If the File Status Code not listed above, please use our Free ABEND ASSIST software

For more technical support, ask our Experts in our Mainframe Forum

 

Home | Mainframe Wiki | Downloads | Programs | Mainframe Forum