File Status Codes

Any code placed in the subfield location *STATUS that is greater than 99 is considered to be an exception/error condition. When the status code is greater than 99; the error indicator — if specified in positions 73 and 74 — is set on, or the %ERROR built-in function — if the 'E' extender is specified — is set to return '1'; otherwise, the file exception/error subroutine receives control. Location *STATUS is updated after every file operation.

You can use the %STATUS built-in function to get information on exception/errors. It returns the most recent value set for the program or file status. If a file is specified, %STATUS returns the value contained in the INFDS *STATUS field for the specified file.

The codes in the following tables are placed in the subfield location *STATUS for the file information data structure:

Table 1. Normal Codes
Code Device1 RC2 Condition
00000     No exception/error.
00002 W n/a Function key used to end display.
00011 W,D,SQ 11xx End of file on a read (input).
00012 W,D,SQ n/a No-record-found condition on a CHAIN, SETLL, and SETGT operations.
00013 W n/a Subfile is full on WRITE operation.
Note: 1Device refers to the devices for which the condition applies. The following abbreviations are used: P = PRINTER; D = DISK; W = WORKSTN; SP = SPECIAL; SQ = Sequential. The major/minor return codes under column RC apply only to WORKSTN files. 2The formula mmnn is used to described major/minor return codes: mm is the major and nn the minor.
Table 2. Exception/Error Codes
Code Device1 RC2 Condition
01011 W,D,SQ n/a Undefined record type (input record does not match record identifying indicator).
01012 D n/a The number of keys is not valid for %KDS.
01021 W,D,SQ n/a Tried to write a record that already exists (file being used has unique keys and key is duplicate, or attempted to write duplicate relative record number to a subfile).
01022 D n/a Referential constraint error detected on file member.
01023 D,SQ n/a Error in trigger program before file operation performed.
01024 D,SQ n/a Error in trigger program after file operation performed.
01031 W,D,SQ n/a Match field out of sequence.
01041 n/a n/a Array/table load sequence error.
01042 n/a n/a Array/table load sequence error. Alternate collating sequence used.
01051 n/a n/a Excess entries in array/table file.
01061 n/a n/a Error handling for an associated variable for a file parameter
01071 W,D,SQ n/a Numeric sequence error.
011214 W n/a No indicator on the DDS keyword for Print key.
011224 W n/a No indicator on the DDS keyword for Roll Up key.
011234 W n/a No indicator on the DDS keyword for Roll Down key.
011244 W n/a No indicator on the DDS keyword for Clear key.
011254 W n/a No indicator on the DDS keyword for Help key.
011264 W n/a No indicator on the DDS keyword for Home key.
01201 W 34xx Record mismatch detected on input.
01211 all n/a I/O operation to a closed file.
01215 all n/a OPEN issued to a file already opened.
012163 all yes Error on an implicit OPEN/CLOSE operation.
012173 all yes Error on an explicit OPEN/CLOSE operation.
01218 D,SQ n/a Record already locked.
01221 D,SQ n/a Update operation attempted without a prior read.
01222 D,SQ n/a Record cannot be allocated due to referential constraint error
01231 SP n/a Error on SPECIAL file.
01235 P n/a Error in PRTCTL space or skip entries.
01241 D,SQ n/a Record number not found. (Record number specified in record address file is not present in file being processed.)
01251 W 80xx 81xx Permanent I/O error occurred.
01255 W 82xx 83xx Session or device error occurred. Recovery may be possible.
01261 W n/a Attempt to exceed maximum number of acquired devices.
01271 W n/a Attempt to acquire unavailable device
01281 W n/a Operation to unacquired device.
01282 W 0309 Job ending with controlled option.
01284 W n/a Unable to acquire second device for single device file
01285 W 0800 Attempt to acquire a device already acquired.
01286 W n/a Attempt to open shared file with SAVDS or IND options.
01287 W n/a Response indicators overlap IND indicators.
01299 W,D,SQ yes Other I/O error detected.
01331 W 0310 Wait time exceeded for READ from WORKSTN file.
Note:
  1. Device refers to the devices for which the condition applies. The following abbreviations are used: P = PRINTER; D = DISK; W = WORKSTN; SP = SPECIAL; SQ = Sequential. The major/minor return codes under column RC apply only to WORKSTN files.
  2. The formula mmnn is used to described major/minor return codes: mm is the major and nn the minor.
  3. Any errors that occur during an open or close operation will result in a *STATUS value of 1216 or 1217 regardless of the major/minor return code value.
  4. See Figure 2 for special handling.

The following table shows the major/minor return code to *STATUS value mapping for errors that occur to programs using WORKSTN files only. See the Information Center for more information on major/minor return codes.

Major Minor *STATUS
00,02 all 00000
03 all (except 09,10) 00000
03 09 01282
03 10 01331
04 all 01299
08 all 012851
11 all 00011
34 all 01201
80,81 all 01251
82,83 all 01255
Note:
  1. The return code field will not be updated for a *STATUS value of 1285, 1261, or 1281 because these conditions are detected before calling data management. To monitor for these errors, you must check for the *STATUS value and not for the corresponding major/minor return code value.