Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

Interpreting the status-code returned by CBL_COPY_FILE

Interpreting the status-code returned by CBL_COPY_FILE

PROBLEM

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?

RESOLUTION

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.

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-03-26 08:36
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.