STATUS CODE


This field is returned by certain file-related statements (for example, CREATE, OPEN, READ, etc.) that result in a false condition, thereby setting the next true/false status indicator to F. STATUS CODE is a token field and contains a value indicating the reason for the I/O command failure, such as:

·    FI_AOF - Record Already on File (following a WRITE or REWRITE)

·    FI_EOF - End of File (following a READNEXT)

·    FI_NOF - Record Not in File (following a READ)

STATUS CODE can be used to set the primary key to the system message file (--- MESSAGE) to obtain a descriptive I/O error message, as shown in the example below.

          OPEN     TGL ACCTMS    SHARE? Y  FAIL 0 CACHE? N
    F     ERROR    Unexpected Error OPEN TGL ACCTMS (see error message below)
    F     SET      --- MESSAGE ID                 =  --- STATUS CODE
    F     READ     --- MESSAGE                HOLD 0 FT 0 BY MESSAGE ID

    FT    SET      --- TEMP 80                    =  --- MESSAGE TXT
    FT    ERROR    TEMP 80

The descriptive message is the same message that would be generated by setting the FAIL (or FT) parameter on the I/O statement appropriately (where 0=nothing, 1=warning, 2=error, 3=cancel).