If the FILE STATUS clause is specified in the FILE-CONTROL entry, a value is placed in the specified status key (the 2-character data item named in the FILE STATUS clause) during execution of any request on that file; the value indicates the status of that request. The value is placed in the status key before execution of any EXCEPTION/ERROR declarative or INVALID KEY/AT END phrase associated with the request.
There are two status key data-names. One is described by data-name-1 in the FILE STATUS clause of the FILE-CONTROL entry. This is a two character data item with the first character known as status key 1 and the second character known as status key 2. The combinations of possible values and their meanings are shown in Table 35.
X The other status key is described by data-name-8 in the FILE STATUS clause
X of the FILE-CONTROL entry. Data-name-8 does not apply to QSAM files
X (OS/390 and VM only) or to line-sequential files (Workstation only). .
___________________________________________________________________________ | Table 35. Status key values and meanings | |_______ ______________ _______ ____________________________________________| | High- | Meaning | Low- | Meaning | | order | | order | | | digit | | digit | | |_______|______________|_______|____________________________________________| | 0 | Successful | 0 | No further information | | | completion |_______|____________________________________________| | | | 2 | This file status value only applies to | | | | | indexed files with alternate keys that | | | | | allow duplicates. | | | | | | | | | | The input-output statement was | | | | | successfully executed, but a duplicate key | | | | | was detected. For a READ statement the | | | | | key value for the current key of reference | | | | | was equal to the value of the same key in | | | | | the next record within the current key of | | | | | reference. For a REWRITE or WRITE | | | | | statement, the record just written created | | | | | a duplicate key value for at least one | | | | | alternate record key for which duplicates | | | | | are allowed. | | | |_______|____________________________________________| | | | 4 | 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. | | | |_______|____________________________________________| | | | 5 | 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 | X | | | | the open mode is I-O or EXTEND. This does | X | | | | not apply to OS/390 and VM VSAM sequential | X | | | | files. | | | |_______|____________________________________________| | | | 7 | 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. | |_______|______________|_______|____________________________________________| | 1 | At end | 0 | A sequential READ statement was attempted | | | condition | | and no next logical record existed in the | | | | | file because the end of the file had been | | | | | reached, or the first READ was attempted | | | | | on an optional input file that was not | | | | | present. | | | |_______|____________________________________________| | | | 4 | A sequential READ statement was attempted | | | | | for a relative file and the number of | | | | | significant digits in the relative record | | | | | number was larger than the size of the | | | | | relative key data item described for the | | | | | file. | |_______|______________|_______|____________________________________________| | 2 | Invalid key | 1 | A sequence error exists for a sequentially | | | condition | | accessed indexed file. The prime record | | | | | key value has been changed by the program | | | | | between the successful execution of a READ | | | | | statement and the execution of the next | | | | | REWRITE statement for that file, or the | | | | | ascending requirements for successive | | | | | record key values were violated. | | | |_______|____________________________________________| | | | 2 | An attempt was made to write a record that | | | | | would create a duplicate key in a relative | | | | | file; or an attempt was made to write or | | | | | rewrite a record that would create a | | | | | duplicate prime record key or a duplicate | | | | | alternate record key without the | | | | | DUPLICATES phrase in an indexed file. | | | |_______|____________________________________________| | | | 3 | An attempt was made to randomly access a | | | | | record that does not exist in the file, or | | | | | a START or random READ statement was | | | | | attempted on an optional input file that | | | | | was not present. | | | |_______|____________________________________________| | | | 4 | An attempt was made to write beyond the | | | | | externally defined boundaries of a | | | | | relative or indexed file. Or, a | | | | | sequential WRITE statement was attempted | | | | | for a relative file and the number of | | | | | significant digits in the relative record | | | | | number was larger than the size of the | | | | | relative key data item described for the | | | | | file. | |_______|______________|_______|____________________________________________| | 3 | Permanent | 0 | No further information | | | error |_______|____________________________________________| | | condition | 4 | A permanent error exists because of a | | | | | boundary violation; an attempt was made to | | | | | write beyond the externally-defined | | | | | boundaries of a sequential file. | | | |_______|____________________________________________| | | | 5 | An OPEN statement with the INPUT, I-O, or | | | | | EXTEND phrase was attempted on a | | | | | non-optional file that was not present. | | | |_______|____________________________________________| | | | 7 | An OPEN statement was attempted on a file | | | | | that would not support the open mode | | | | | specified in the OPEN statement. Possible | | | | | violations are: | | | | | | | | | | 1. The EXTEND or OUTPUT phrase was | | | | | specified but the file would not | | | | | support write operations. | | | | | 2. The I-O phrase was specified but the | | | | | file would not support the input and | | | | | output operations permitted. | | | | | 3. The INPUT phrase was specified but the | | | | | file would not support read | | | | | operations. | | | |_______|____________________________________________| | | | 8 | An OPEN statement was attempted on a file | | | | | previously closed with lock. | | | |_______|____________________________________________| | | | 9 | The OPEN statement was unsuccessful | | | | | because a conflict was detected between | | | | | the fixed file attributes and the | | | | | attributes specified for that file in the | | | | | program. These attributes include the | | | | | organization of the file (sequential, | | | | | relative, or indexed), the prime record | | | | | key, the alternate record keys, the code | | | | | set, the maximum record size, the record | | | | | type (fixed or variable), and the blocking | | | | | factor. | | | | | | X | | | | Under AIX and Windows, file status 39 is | X | | | | not supported for line-sequential files or | X | | | | Btrieve files. | |_______|______________|_______|____________________________________________| | 4 | Logic error | 1 | An OPEN statement was attempted for a file | | | condition | | in the open mode. | | | |_______|____________________________________________| | | | 2 | A CLOSE statement was attempted for a file | | | | | not in the open mode. | | | |_______|____________________________________________| | | | 3 | For a mass storage file in the sequential | | | | | access mode, the last input-output | | | | | statement executed for the associated file | | | | | prior to the execution of a REWRITE | | | | | statement was not a successfully executed | | | | | READ statement. | | | | | | | | | | For relative and indexed files in the | | | | | sequential access mode, the last | | | | | input-output statement executed for the | | | | | file prior to the execution of a DELETE or | | | | | REWRITE statement was not a successfully | | | | | executed READ statement. | | | |_______|____________________________________________| | | | 4 | A boundary violation exists because an | | | | | attempt was made to rewrite a record to a | | | | | file and the record was not the same size | | | | | as the record being replaced, or an | | | | | attempt was made to write or rewrite a | | | | | record that was larger than the largest or | | | | | smaller than the smallest record allowed | | | | | by the RECORD IS VARYING clause of the | | | | | associated file-name. | | | |_______|____________________________________________| | | | 6 | A sequential READ statement was attempted | | | | | on a file open in the input or I-O mode | | | | | and no valid next record had been | | | | | established because: | | | | | | | | | | 1. The preceding READ statement was | | | | | unsuccessful but did not cause an at | | | | | end condition | | | | | 2. The preceding READ statement caused an | | | | | at end condition. | | | |_______|____________________________________________| | | | 7 | The execution of a READ statement was | | | | | attempted on a file not open in the input | | | | | or I-O mode. | | | |_______|____________________________________________| | | | 8 | The execution of a WRITE statement was | | | | | attempted on a file not open in the I-O, | | | | | output, or extend mode. | | | |_______|____________________________________________| | | | 9 | The execution of a DELETE or REWRITE | | | | | statement was attempted on a file not open | | | | | in the I-O mode. | |_______|______________|_______|____________________________________________| | | 9 | Implementor- | 0 | Under AIX and Windows: No further | | | | defined | | information. | | | condition | | | | | | | | For VSAM only under OS/390 and VM: See the | | | | | | information on VSAM return codes in the | | | | | | IBM COBOL for OS/390 & VM Programming | | | | | | Guide. | | | |_______|____________________________________________| | | | 1 | For VSAM only under OS/390 and VM: | | | | | Password failure. | | | | | | | | | | Under AIX and Windows: Authorization | | | | | failure. | | | |_______|____________________________________________| | | | 2 | Logic error. | | | |_______|____________________________________________| | | | 3 | For all files, except QSAM: Resource not | | | | | available. | | | |_______|____________________________________________| | | | 4 | For VSAM under OS/390 and VM with CMPR2 | | | | | compiler-option only: No file position | | | | | indicator for sequential request. | | | | | | | | | | Under AIX and Windows: Concurrent open | | | | | error. | | | |_______|____________________________________________| | | | 5 | For all files, except QSAM: Invalid or | | | | | incomplete file information. | | | |_______|____________________________________________| | | | | 6 | For VSAM file under OS/390 and VM: 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 under OS/390 and VM: 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 the CBLQDA(OFF) | | | | | | run-time option was specified. | | | | | | | | | | Under AIX and Windows: File system not | | | | | available. | | | |_______|____________________________________________| | | | 7 | For VSAM only under OS/390 and VM: OPEN | | | | | statement execution successful: File | | | | | integrity verified. | | | | | | | | | | Under AIX and Windows: Errors related to | | | | | remote file access. | | | |_______|____________________________________________| | | | 8 | Under AIX and Windows: Open failed due to | | | | | locked file. | | | | | | | | | | | Under OS/390: Open failed due to either | | | | | | the invalid contents of an environment | | | | | | variable specified in a SELECT ... ASSIGN | | | | | | clause, or failed dynamic allocation. For | | | | | | more information about the conditions | | | | | | under which this status can occur, see | | | | | | "ASSIGN clause" in topic 4.2.3. | | | |_______|____________________________________________| | | | 9 | Under AIX and Windows: Record access | | | | | failed due to locked record. | |_______|______________|_______|____________________________________________|