CALL "C$RERR" USING EXTEND-STAT, TEXT-MESSAGE, STATUS-TYPE
EXTEND-STAT (returned) | PIC X(5) or larger; PIC X(7) or larger under VMS |
TEXT-MESSAGE (returned) | PIC X(n) |
STATUS-TYPE (input) | Numeric parameter |
C$RERR must be passed a USING argument that should be PICTURE X(5) or larger. This argument is filled in with either the extended file status caused by the last file I/O, or the extended transaction status caused by the last transaction operation. The value of STATUS-TYPE determines which status will be filled in.
A text message is available for some 9D errors, which are host system errors. When a text message is available, it's moved into the data item TEXT-MESSAGE, and returned as the second parameter. You can use TEXT-MESSAGE to display text to the user, so the user can decide what action to take. This parameter is ignored for transaction status.
The third parameter, STATUS-TYPE, controls whether file status or transaction status information is returned by the routine. If STATUS-TYPE is set to 1 or the parameter is omitted, file status is returned. If STATUS-TYPE is set to 2, transaction status is returned.
The first two characters of the extended file status are identical to the normal FILE STATUS value returned by ACUCOBOL-GT for a file operation. The last two characters further clarify the reason for the particular FILE STATUS value. The values used here are listed in the file status table found in Appendix E of the ACUCOBOL-GT product documentation . If the file status (first two characters) is 30, the remainder of the information is the operating system's status code explaining what caused the error.
On some systems, the operating system requires more than two digits for its status codes. That is why the C$RERR routine may be passed a field that is larger than four characters. Whenever an error 30 occurs, the operating system's status value is returned in this extended field. The number returned is a left-justified decimal value. If the receiving field is too small, the right-most digits are returned. If the receiving field is too large, the excess characters are filled with spaces.
The first two characters of the extended transaction status are identical to the contents of the TRANSACTION-STATUS register. The last two characters further clarify the reason for the particular transaction status value. The values used here are listed in the transaction status table found in Appendix E the transaction status table found in Appendix E of the ACUCOBOL-GT product documentation .
In a few cases, there may also be a tertiary status code. If there is one, a comma will be placed immediately after the secondary status code, and the tertiary code will then appear left-justified.