NOTICE: Our Community is moving. Get more information.
Using CBL_COPY_FILE returning status-code. 0 = successful non-0 = not successful
Is there a way to interpret the value of status-code to determine the reason for the failure similar to the file status and extended file status?
Actually, the value returned for status-code if used or in the RETURN-CODE special register is a file status code.
You can check the success of the call by examining RETURN-CODE.
Interpreting the return code as a file status code If any of the routines
CBL_CHECK_FILE_EXIST CBL_COPY_FILE CBL_CREATE_FILE CBL_DELETE_FILE CBL_OPEN_FILE CBL_READ_FILE CBL_RENAME_FILE CBL_WRITE_FILE CBL_CHANGE_DIR CBL_CREATE_DIR CBL_DELETE_DIR CBL_READ_DIR 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:
01 file-status pic xx comp-x. 01 redefines file-status. 03 fs-byte-1 pic x. 03 fs-byte-2 cblt-x1-compx . . . 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.