File Status Values
Introduction
This paper documents values assigned to the FILE STATUS item both by Fujitsu and other vendors. The purpose of the paper is to help you understand the values returned by NetCOBOL in the situations that cause the other COBOL dialects to generate values.
The FILE STATUS item is defined in the FILE STATUS clause of the file control entry. Its purpose is to enable programs to receive and interpret detailed information on file errors.
The values returned fall into two categories: ANSI COBOL defined and implementor defined. The ANSI standard values and the NetCOBOL defined values are documented in full in Appendix B of the NetCOBOL User's Guide.
The tables below show how various dialects support the standard values and how implementor specific values can be mapped to NetCOBOL values. For full and up-to-date descriptions of the meanings of each return code see each vendors' documentation.
A number of implementor defined values were created before the 1985 ANSI COBOL standard was published. Some of these values were returned for conditions that were added to the 1985 ANSI COBOL standard. Consequently many implementor defined values map directly to ANSI 85 COBOL values.
Vendor Styles
Different vendors give different options for passing back extended file status values. The standard style for FILE STATUS is:
SELECT filename
...
FILE STATUS file-status-key
...
...
01 file-status-key.
03 file-status-key-1 PIC X.
03 file-status-key-2 PIC X.
The ANSI standard defines values for file-status-key-1 and file-status-key-2, and states that if file-status-key-1 is "9", then the values for file-status-key-2 are implementor defined. Different vendors extend the ANSI definition, particularly for the implementor defined values, in different ways.
NetCOBOL Fujitsu follows the ANSI standard style for regular COBOL files, and adds a few implementor defined values.
For PowerFORM print files, Fujitsu defines additional codes and provides more detailed information in a second data item specified in the FILE STATUS clause.
IBM COBOL IBM OSVS and VS COBOL II follow the ANSI standard style and provide a few implementor defined values.
For VSAM files more detailed information is available in a second data item specified in the FILE STATUS clause.
Micro Focus COBOL Micro Focus follows the ANSI standard style except that status-byte-2 for implementor defined values is a binary number, not an ASCII character. There are close to a hundred implementor defined values.
RM/COBOL RM COBOL follows the ANSI style and provides many implementor defined values. More detailed information is obtained by passing the file status value to a sub-routi
Compatibility with Other Vendors
The table below shows the status values returned by NetCOBOL and the ANSI standard status key values supported by various COBOL dialects, along with a brief description. For full and accurate descriptions see each vendor's documentation.
The dialects are:
74 - ANSI 74
85 - ANSI 85
FU - NetCOBOL
OS - IBM OSVS COBOL
VS - IBM VS COBOL II
MF - Micro Focus COBOL
RM - RM COBOL
| Key | Dialect | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 2 | 74 | 85 | F U |
O S |
V S |
M F |
R M |
|||||||||
| 0 | Successful completion codes | ||||||||||||||||
| 0 | 0 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | No further information | ||||||||
| 0 | 0 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | Duplicate key detected | ||||||||
| 0 | 4 | 4 | 4 | 4 | 4 | 4 | Record length does not conform to fixed file attributes | ||||||||||
| 0 | 5 | 4 | 4 | 4 | 4 | 4 | File not present (for optional file) | ||||||||||
| 0 | 7 | 4 | 4 | 4 | 4 | 4 | File is a non-reel/unit medium but referenced as if it were | ||||||||||
| 1 | At end conditions (unsuccessful completion) | ||||||||||||||||
| 1 | 0 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | End of file on sequential READ or optional file not present | ||||||||
| 1 | 4 | 4 | 4 | 4 | 4 | 4 | Relative record number larger than relative key | ||||||||||
| 2 | Invalid key conditions (unsuccessful completion) | ||||||||||||||||
| 2 | 0 | ||||||||||||||||
| 2 | 1 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | Key sequence error | ||||||||
| 2 | 2 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | Duplicate key error | ||||||||
| 2 | 3 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | Record does not exist | ||||||||
| 2 | 4 | 4 | 4 | 4 | 4 | 4 | Boundary violation (relative and indexed files) | ||||||||||
| 3 | Permanent error conditions (unsuccessful completion) | ||||||||||||||||
| 3 | 0 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | No further information | ||||||||
| 3 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | Boundary violation (sequential file) | ||||||||
| 3 | 5 | 4 | 4 | 4 | 4 | 4 | File not present | ||||||||||
| 3 | 7 | 4 | 4 | 4 | 4 | 4 | OPEN mode not supported by specified file | ||||||||||
| 3 | 8 | 4 | 4 | 4 | 4 | 4 | OPEN attempted on file closed with lock | ||||||||||
| 3 | 9 | 4 | 4 | 4 | 4 | 4 | Conflict between fixed and defined file attributes | ||||||||||
| Key | Dialect | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 2 | 74 | 8 5 |
F U |
O S |
V S |
M F |
R M |
|||||||||
| 4 | Logic error conditions (unsuccessful completion) | ||||||||||||||||
| 4 | 1 | 4 | 4 | 4 | 4 | 4 | File already open | ||||||||||
| 4 | 2 | 4 | 4 | 4 | 4 | 4 | File not opened | ||||||||||
| 4 | 3 | 4 | 4 | 4 | 4 | 4 | DELETE or REWRITE without successful READ | ||||||||||
| 4 | 4 | 4 | 4 | 4 | 4 | 4 | Boundary violation | ||||||||||
| 4 | 6 | 4 | 4 | 4 | 4 | 4 | Sequential READ with no valid next record | ||||||||||
| 4 | 7 | 4 | 4 | 4 | 4 | 4 | READ on file not opened in INPUT or I/O mode | ||||||||||
| 4 | 8 | 4 | 4 | 4 | 4 | 4 | WRITE on file not opened in appropriate mode | ||||||||||
| 4 | 9 | 4 | 4 | 4 | 4 | 4 | DELETE or REWRITE on file not open in I/O mode | ||||||||||
| 9 | Implementor defined conditions | ||||||||||||||||
| 9 | 0 | 4 | Unclassified error | ||||||||||||||
| 9 | 1 | 4 | No file assigned. | ||||||||||||||
| 9 | 2 | 4 | Exclusive error on RDM file | ||||||||||||||
| 9 | 3 | 4 | Exclusive error associated with a file lock | ||||||||||||||
| 9 | 9 | 4 | Exclusive error associated with a record lock | ||||||||||||||
| 9 | E | 4 | FORM RTS - READ statement execution compulsorily released | ||||||||||||||
IBM COBOL Specific Status Key Values 1. OS/VS COBOL
| Status Key | Description | NetCOBOL Equivalent Status | |
|---|---|---|---|
| 1 | 2 | ||
| 9
9 9 |
0*
3 6** |
OPEN on a non-OPTIONAL file that is not present.
*QSAM designation. **VSAM designation. |
3-5 |
| 9 | 0 | OPEN statement attempted on a file that would not support the open mode specified | 3-7 |
| 9 | 2 | OPEN statement attempted on a file previously closed with a lock. | 3-8 |
| 9 9 |
0* 5** |
OPEN unsuccessful because a conflict was detected between the fixed file attributes and the attributes specified for that file in the program.
*QSAM designation. **VSAM designation. |
3-9 |
| 9 | 2 | OPEN attempted for a file in the open mode. | 4-1 |
| 9 | 2 | CLOSE attempted for a file that was already closed.. | 4-2 |
| 9 | 2 | REWRITE or DELETE without a preceding successful READ. | 4-3 |
| 9 | 2 | Boundary violation. | 4-4 |
| 9
9 |
2*
4** |
READ with no valid next record
*QSAM designation. **VSAM designation. |
4-6 |
| 9 | 2 | READ attempted on a file not open in the input or I-O mode. | 4-7 |
| 9 | 2 | WRITE attempted on a file not open in the I-O, output, or extend mode. | 4-8 |
| 9 | 2 | DELETE or REWRITE statement on a file not open in the I-O mode. | 4-9 |
2. OS/VS COBOL AND VS COBOL II
| Status Key | Description | NetCOBOL Equivalent Status | |
|---|---|---|---|
| 1 | 2 | ||
| 9 | 0 | Extended file Status Code. Other errors with no further information. | 9-0 |
| 9 | 1 | VSAM password failure. | No equivalent |
| 9 | 2 | Logic error. | 4-? or no equivalent |
| 9 | 3 | VSAM resource not available. | No equivalent |
| 9 | 5 | Invalid or incomplete VSAM file information. | No equivalent |
| 9
9 9 |
0*
6** 6 |
No file identification. (No DD statement for the file.)
*QSAM designation. **VSAM designation. |
9-1 |
| 9 | 5 | OPEN statement execution successful; file integrity verified. | 0-0
(But no equivalent file integrity checking performed.) |
Micro Focus Specific Status Key Values
In the file-status-key-2 column (headed with a "2") the three digits (e.g. 001) indicate a binary value for that byte.
| Status Key | Description | NetCOBOL Equivalent Status | |
|---|---|---|---|
| 1 | 2 | ||
| 9 | 001 | Insufficient buffer space | |
| 9 | 002 | File not open when access attempted | 4-2, 4-7, 4-8, or 4-9 |
| 9 | 003 | Serial mode error | |
| 9 | 004 | Illegal file name | 9-1 |
| 9 | 005 | Illegal device specification | 9-1 |
| 9 | 006 | Attempt to write to a file opened for input | 4-8 or 4-9 |
| 9 | 007 | Disk space exhausted | Sequential files 3-4,
Indexed files 9-0 (If run-time errors are switched on "DISK SPACE EXHAUSTED" is displayed) Relative files 2-4 |
| 9 | 008 | Attempt to input from a file opened for output | 4-7 |
| 9 | 009 | No room in directory or directory does not exist | 9-1 |
| 9 | 010 | File name not supplied | 9-1 |
| 9 | 012 | Attempt to open a file which is already open | 4-1 |
| 9 | 013 | File not found | 9-1 |
| 9 | 014 | Too many files opened simultaneously | ? |
| 9 | 015 | Too many indexed files open | ? |
| 9 | 016 | Too many devices open | ? |
| 9 | 017 | Record error: probably zero length | Possibly will report 1-0 |
| 9 | 018 | Read part record error: EOF before EOR or file open in wrong mode | Not reported |
| 9 | 019 | Rewrite error: open mode or access mode wrong | 4-9 |
| 9 | 020 | Device or resource busy | ? |
| 9 | 021 | File is a directory | 9-0 |
| 9 | 022 | Illegal or impossible access mode for OPEN | 3-7 |
| 9 | 023 | Illegal or impossible access mode for CLOSE | Not clear when this would be generated |
| 9 | 024 | Disk I/O error | Not reported (?) |
| 9 | 025 | Operating system data error | Not reported (?) |
| 9 | 026 | Block I/O error | Not reported (?) |
| 9 | 027 | Device not available | 9-1 |
| 9 | 028 | No space on device | Sequential files 3-4,
Indexed files 9-0 (If run-time errors are switched on "DISK SPACE EXHAUSTED" is displayed) Relative files 2-4 |
| 9 | 029 | Attempt to delete open file | DELETE file not supported |
| 9 | 030 | File system is read only | 9-0 |
| 9 | 031 | Not owner of file | ? (UNIX only) |
| 9 | 032 | Too many indexed files, or no such process | ? |
| 9 | 033 | Physical I/O error | 3-0 (disk not in drive) |
| 9 | 034 | Incorrect mode or file descriptor | 4-7, or 4-8 |
| 9 | 035 | Attempt to access a file with incorrect permission | 9-0 |
| 9 | 036 | File already exists | Probably 4-8 |
| 9 | 037 | File access denied | 9-0 |
| 9 | 038 | Disk not compatible | ? |
| 9 | 039 | File not compatible | Not reported, or may be reported as an invalid key (2-3) or other record format mismatch depending on the type of incompatibility. |
| 9 | 040 | Language initialization not set up correctly | Not applicable. |
| 9 | 041 | Corrupt index file | Depends on type of corruption. May return 2-3 |
| 9 | 042 | Attempt to write on broken pipe | N/A ? |
| 9 | 043 | File information missing for indexed file | N/A ? |
| 9 | 045 | Attempt to open an NLS file using an incompatible program | N/A ? |
| 9 | 047 | Indexed structure overflow | N/A ? |
| 9 | 065 | File locked | 9-3 |
| 9 | 066 | Attempt to add duplicate record key to indexed file | 2-2 |
| 9 | 067 | Indexed file not open | 4-7 or 4-8 |
| 9 | 068 | Record locked | N/A (no record locking) |
| 9 | 069 | Illegal argument to ISAM module | N/A ? |
| 9 | 070 | Too many indexed files open | <<Ask what is expected to happen>> |
| 9 | 071 | Bad indexed file format | N/A (internal system error) |
| 9 | 072 | End of indexed file | N/A (internal system error) |
| 9 | 073 | No record found in indexed file | N/A (internal system error) |
| 9 | 074 | No current record in indexed file | N/A (internal system error) |
| 9 | 075 | Indexed data file name too long | N/A (doesn't create another file name) |
| 9 | 077 | Internal ISAM module failure | N/A (internal system error) |
| 9 | 078 | Illegal key description in indexed file | N/A (internal system error) |
| 9 | 081 | Key already exists in indexed file | N/A (internal system error) |
| 9 | 100 | Invalid file operation | 4-3 or 4-9 |
| 9 | 101 | Illegal operation on an indexed file | N/A (internal system error) |
| 9 | 102 | Sequential file with non-integral number of records | Not reported |
| 9 | 104 | Null file name used in a file operation | 9-1 |
| 9 | 105 | Memory allocation error | ? |
| 9 | 129 | Attempt to access record zero of relative file | 2-3 or 2-4 |
| 9 | 135 | File must not exist | 9-1 |
| 9 | 138 | File closed with lock - cannot be opened | 3-8 |
| 9 | 139 | Record length or key data inconsistency | 3-9 |
| 9 | 141 | File already open - cannot be opened | 4-1 |
| 9 | 142 | File not open - cannot be closed | 4-2 |
| 9 | 143 | REWRITE/DELETE in sequential mode not preceded by successful READ | 4-3 |
| 9 | 146 | No current record defined for sequential read | 4-6 |
| 9 | 147 | Wrong open mode or access mode for READ/START | 4-7 |
| 9 | 148 | Wrong open mode or access mode for WRITE | 4-8 |
| 9 | 149 | Wrong open mode or access mode for REWRITE/DELETE | 4-9 |
| 9 | 150 | Program abandoned at user request | N/A - Not a file I/O error |
| 9 | 151 | Random read on sequential file | N/A - Not allowed by compiler. |
| 9 | 152 | REWRITE on file not opened I-O | 4-9 |
| 9 | 158 | Attempt to REWRITE to a line-sequential file | N/A - Compiler does not allow OPEN I-O of line-sequential files |
| 9 | 159 | Malformed line-sequential file | Not reported (?) |
| 9 | 161 | File header not found (also described as illegal intermediate code) | 3-9 |
| 9 | 173 | Called program not found | N/A - Not a file I/O error |
| 9 | 180 | End-of-file marker error | N/A - NetCOBOL does not use end-of-file markers |
| 9 | 182 | Console input or console output open in wrong direction | N/A - NetCOBOL does not use files for input or output to the console |
| 9 | 183 | Attempt to open line-sequential file for I-O | N/A - Not allowed by the compiler |
| 9 | 188 | File name too large | 3-0 |
| 9 | 193 | Error in variable length count | N/A - Micro Focus intermediate code error |
| 9 | 194 | File size too large | <<Check if this is possible and what would happen>> |
| 9 | 195 | DELETE/REWRITE not preceded by a successful READ | 4-3 |
| 9 | 196 | Record number too large in relative or indexed file | 2-4 |
| 9 | 210 | File is closed with lock | 3-8 |
| 9 | 213 | Too many locks | N/A - NetCOBOL does not support record locking |
| 9 | 218 | Malformed MULTIPLE REEL/UNIT file | <<Is this still relevant?>> |
| 9 | 219 | Operating system shared file limit exceeded | <<Find out what is expected to happen>> |
RM/COBOL Specific Status Key Values
Early versions of RM/COBOL returned extended file status values in response to a call to the C$RERR routine. The tables below give the status key values before and after the call to C$RERR.
| Status Key | Description | NetCOBOL Equivalent | ||
|---|---|---|---|---|
| 1 | 2 | After C$RERR | Status | |
| 9 | 0 | 9/006 | Attempt to write to a file opened for input. | 4-8 |
| 9/008 | Attempt to read from a file opened for output. | 4-7 | ||
| 9/018 | Attempt to read part of a record | No equivalent | ||
| 9/019 | Rewrite error: open mode or access mode wrong. | 4-9 | ||
| 9/100 | Invalid file operation. | 9-0 or no equivalent | ||
| 9/101 | Illegal operation on indexed file. | 9-0 or no equivalent | ||
| 9/139 | Record length or key inconsistent. | 2-1, 2-4, or 3-9 | ||
| 9/143 | REWRITE/DELETE not after successful READ. | 4-3 | ||
| 9/147 | Wrong open or access mode for READ/START. | 4-7 | ||
| 9/148 | Wrong open or access mode for WRITE. | 4-8 | ||
| 9/149 | Wrong open or access mode for REWRITE/DELETE | 4-9 | ||
| 9/151 | Random read on sequential file | N/A - Not allowed by compiler | ||
| 9/152 | REWRITE on file not opened I-O. | 4-9 | ||
| 9/158 | REWRITE on line sequential file. | N/A - Compiler does not allow OPEN I-O of line-sequential files | ||
| 9/182 | Console in/out open in wrong mode. | N/A - NetCOBOL does not use files for input or output to the console | ||
| 9/195 | DELETE/REWRITE not preceded by READ | 4-3 | ||
| 9 | 1 | 9/002 | File not open when access attempted. | 4-2, 4-7, 4-8, or 4-9 |
| 9/067 | Indexed file not open. | 4-7 or 4-8 | ||
| 9/142 | File not open- cannot be closed. | 4-2 | ||
| 2 | 9/012 | Attempt to open a file which is already open. | 4-1 | |
| 9/066 | Attempt to add duplicate key to indexed file. | 2-2 | ||
| 9/081 | Key already exists in indexed file. | 2-2 | ||
| 9/141 | File already open- cannot be opened. | 4-1 | ||
| 3 | 9/065 | File locked. | 3-8 | |
| 9/138 | File is closed with lock- cannot open. | 3-8 | ||
| 9/210 | File is closed with lock. | 3-8 | ||
| 4 | 9/002 | Illegal file-name | 9-1 | |
| 9/013 | File not found. | 9-1 | ||
| 9/030 | File system is read only. | 9-0 | ||
| 9/031 | Not owner of this file. | ? (UNIX only) | ||
| 9/035 | Incorrect access permission. | 9-0 | ||
| 9/037 | File access denied. | 9-0 | ||
| 9/075 | Indexed file-name too long. | 3-0 | ||
| 9/104 | Null file-name used in file operation. | 9-1 | ||
| 9/139 | Record length or key inconsistent. (UNIX) | 2-1, 2-4, or 3-9 | ||
| 9/182 | Console in/out open in wrong mode. (UNIX) | N/A - NetCOBOL does not use files for input or output to the console | ||
| 9/183 | Attempt to open line sequential file for I-O. | N/A - Not allowed by the compiler | ||
| 9/188 | File name too large. | 3-0 | ||
| 9/194 | File size too large. | <<Check if this is possible and what would happen>> | ||
| 5 | 9/005 | Illegal device specification. | 9-1 | |
| 9/038 | Disk not compatible. | ? | ||
| 9/039 | File not compatible. | Not reported, or may be reported as an invalid key (2-3) or other record format mismatch depending on the type of incompatibility. | ||
| 6 | 9/146 | No current record defined for sequential read. | 4-6 | |
| 7 | 9/017 | Record error: probably zero length. | Possibly will report 1-0 | |
| 8 | 9/041 | Corrupt indexed file. | Depends on type of corruption. May return 2-3 | |
| 9/043 | File information missing for indexed file. | 9-1 | ||
| 9/047 | Index structure overflow. | N/A (internal system error) | ||
| 9/069 | Illegal argument to ISAM module. | N/A (internal system error) | ||
| 9/071 | Bad indexed file format. | Depends on type of corruption. May return 2-3 | ||
| 9/072 | End of indexed file. | 2-0 | ||
| 9/073 | No record found in indexed file. | 2-3 | ||
| 9/074 | No current record in indexed file. | 4-6 | ||
| 9/078 | Illegal key description in indexed file. | N/A (internal system error) | ||
| 9/196 | Record number too big in relative/indexed file. | 2-4 | ||
| 9 | 9/065 | File locked. (UNIX) | 3-8 | |
| 9/068 | Record is locked. | N/A - NetCOBOL does not support record locking | ||


