isCOBOL Evolve : Appendices : Library Routines : Interpreting the return code as a file status code
Interpreting the return code as a file status code
The below information is applicable to the following routines:
If any of these routines fails, the RETURN-CODE register contains a file status value indicating the failure. This file status is always the standard ANSI'74 file status value. If no ANSI'74 file status is defined for the error, an extended file status is returned (9/nnn where nnn is the run-time system error number).
You should, therefore, use RETURN-CODE and not a RETURNING clause. If RETURN-CODE is non-zero after calling one of these routines, you must process it as a file status, for example:
       working-storage section.
       ...
       01 file-status      pic xx comp-x
       01 redefines file-status. 
          03 fs-byte-1  pic x
          03 fs-byte-2  pic x comp-x
       ...
       procedure division.
           ...
           call "CBL_xxx_xxx" using parameters 
           if return-code not = 0 
              move return-code to file-status 
           ...
At this point fs-byte-1 contains "9" and fs-byte-2 contains the run-time system error number.