Often the two-digit file status code is too general to pinpoint the disposition of a request. You can get more detailed information about STL and Btrieve file-system input and output requests by coding a second data item in the FILE STATUS clause:
FILE STATUS IS data-name-1 data-name-8
The data item data-name-1 specifies the two-digit COBOL file status key, which must be a two-character category alphanumeric or category national item, or a two-digit zoned decimal or national decimal item. The data item data-name-8 specifies a data item that contains the file-system status code when the COBOL file status key is not zero. data-name-8 is at least 6 bytes long, and must be an alphanumeric item.
If data-name-8 is 6 bytes long, it contains the status code; if data-name-8 is longer than 6 bytes, it also contains a message with further information:
01 my-file-status-2.
02 exception-return-value PIC 9(6).
02 additional-info PIC X(100).
In the example above, if you tried to open a file with a different definition than the one with which it was created, return code 39 would be returned in exception-return-value, and a message that tells which keys you need in order to perform the open would be returned in additional-info.
Example: checking file system status codes
related references
STL file system