PreviousRun-time System Error Messages SAA, OSVS and VSC2 Implementation LimitsNext

Chapter 5: File Status Codes

For each file defined with a FILE STATUS clause, every I/O operation returns a status code. This chapter lists the codes that can be returned. If you are using the standard system loaded for ANSI'85 operation, ANSI'85 codes are produced by default. In order to produce ANSI'74 file status codes, set the -A switch at run time.

Alternatively, compile your program with the directive NOANS85. If you do not specify NOANS85 when compiling, ANSI'85 file status codes are produced.

If you want to use ANSI'85 syntax, but have ANSI'74 file status codes, replace the NOANS85 directive with ANS85"SYNTAX", or remove the NOANS85 directive and use the -A switch at run time.

In addition to the above file status conventions you can produce more detailed extended file status codes. Extended file status codes have the following format:

9/nnn

where:

nnn is a binary (COMP-X) number, equivalent to a run-time error number.

Run-time errors are documented in the chapter Run-time System Messages.

For example, if you are writing a file to disk and the disk runs out of space, the ANSI'74 file status would be "30", which translates into a "Permanent error - no other information is available" error message. That error message is very general; a "permanent error" could mean that the disk has failed, or that the disk drive door is open. So, rather than return a generic file status, this COBOL system returns an extended file status of 9/007.

When using ANSI'74 or ANSI'85 file status codes, the run-time system returns extended status codes if the extended file status is more specific than what would normally be returned.

Unless otherwise specified, each file status code can be received for operations on any file organizations in any access mode.

5.1 List of File Status Codes

'74
'85
Meaning
00 00 Successful completion
02 02 Indexed files only.

One of two possibilities:
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.
00 04 The length of the record being processed does not conform to the fixed file attributes for that file.
00 05 The referenced optional file is not present at the time the OPEN statement is executed.
00 07 Sequential files only. For an OPEN or CLOSE statement with the REEL/UNIT phrase the referenced file is a non-reel/unit medium.
10 10 No next logical record exists.

You have reached the end of the file.
  14 Relative files only.

The number of significant digits in the relative record number is larger than the size of the relative key data item described for that file.
21 21 Sequentially accessed files only.

Indicates a sequence error. The ascending key requirements of successive record key values has been violated, or, the prime record key 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.
22 22 Indexed and relative files only.

Indicates a duplicate key condition. Attempt has been made to store a record that would create a duplicate key in the indexed or relative file OR a duplicate alternate record key that does not allow duplicates.
23 23 Indicates no record found.

An attempt has been made to access a record, identified by a key, and that record does not exist in the file.

Alternatively a START or READ operation has been tried on an optional input file that is not present.
24 24 Relative and indexed files only.

Indicates a boundary violation arising from one of the following conditions:
An attempt is made to write beyond the externally defined boundaries of a file.
A sequential WRITE operation has been tried on a relative file, but the number of significant digits in the relative record number is larger than the size of the relative key data item described for the file.
  30 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.
  34 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.
  35 An OPEN operation with the I-O, INPUT, or EXTEND phrases has been tried on a non-OPTIONAL file that is not present.
  37 An OPEN operation has been tried on a file which does not support the open mode specified in the OPEN statement.
  38 An OPEN operation has been tried on a file previously closed with a lock.
  39 A conflict has been detected between the fixed file attributes and the attributes specified for that file in the program.
  41 An OPEN operation has been tried on file already opened.
  42 A CLOSE operation has been tried on file already closed.
  43 Files in 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.
  44 A boundary violation exists. Possible violations are:
An attempt has been made 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.
An attempt has been made to REWRITE a record to a file, and the record is not the same size as the record it replaces.
  46 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.
  47 A READ or START operation has been tried on a file not opened INPUT or I-O.
  48 A WRITE operation has been tried on a file not opened in the OUTPUT, I-O, or EXTEND mode, or on a file open I-O in the sequential access mode.
  49 A DELETE or REWRITE operation has been tried on a file that is not opened I-O.

5.2 List of Extended File Status Codes

Code Meaning
9/001 Insufficient buffer space. Could also indicate an out-of-memory situation.
9/002 File not open when access tried.
9/003 Serial mode error.
9/004 Illegal filename.
9/005 Illegal device specification.
9/006 Attempt to write to a file opened for input.
9/007 Disk space exhausted.
9/008 Attempt to input from a file opened for output.
9/009 No room in directory or directory does not exist.
9/010 Filename not supplied.
9/012 Attempt to open a file which is already open.
9/013 File not found.
9/014 Too many files open simultaneously.
9/015 Too many indexed files open.
9/016 Too many device files open.
9/017 Record error: probably zero length.
9/018 Read part record error: EOF before EOR or file open in wrong mode.
9/019 Rewrite error: open mode or access mode wrong.
9/020 Device or resource busy.
9/021 File is a directory.
9/022 Illegal or impossible access mode for OPEN.
9/023 Illegal or impossible access mode for CLOSE.
9/024 Disk I/O error.
9/025 Operating system data error.
9/026 Block I/O error.
9/027 Device not available.
9/028 No space on device.
9/029 Attempt to delete open file.
9/030 File system is read only.
9/031 Not owner of file.
9/032 Too many indexed files, or no such process.
9/033 Physical I/O error.
9/034 Incorrect mode or file descriptor.
9/035 Attempt to access a file with incorrect permission.
9/036 File already exists.
9/037 File access denied.
9/038 Disk not compatible.
9/039 File not compatible.
9/040 Language initialization not set up correctly.
9/041 Corrupt index file.
9/042 Attempt to write on broken pipe.
9/043 File information missing for indexed file.
9/045 Attempt to open an NLS file using an incompatible program.
9/047 Indexed structure overflow. (Could indicate that you have reached the maximum number of duplicate keys.)
9/065 File locked.
9/066 Attempt to add duplicate record key to indexed file.
9/068 Record locked.
9/069 Illegal argument to ISAM module.
9/070 Too many indexed files open.
9/071 Bad indexed file format.
9/072 End of indexed file.
9/099 Invalid sort operation.
9/100 Invalid file operation.
9/104 Null filename used in a file operation.
9/105 Memory allocation error.
9/125 All locks/current transactions canceled due to exceeding time limit.
9/138 File closed with lock - cannot be opened.
9/139 Record length or key data inconsistency.
9/141 File already open - cannot be opened.
9/142 File not open - cannot be closed.
9/143 REWRITE/DELETE in sequential mode not preceded by successful READ.
9/146 No current record defined for sequential read.
9/147 Wrong open mode or access mode for READ/START.
9/148 Wrong open mode or access mode for WRITE.
9/149 Wrong open mode or access mode for REWRITE/DELETE.
9/161 File header not found.
9/169  
9/173 Called program not found.
9/188 Filename too large.
9/194 File size too large.
9/195 DELETE/REWRITE not preceded by a READ.
9/196 Record number too large in relative or indexed file.
9/210 File is closed with lock.
9/213 Too many locks.
9/218 Malformed MULTIPLE REEL/UNIT file.
9/219 Operating system shared file limit exceeded.


Copyright © 2002 Micro Focus International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.


PreviousRun-time System Error Messages SAA, OSVS and VSC2 Implementation LimitsNext