Value of RETURN-CODE for CBL_CHECK_FILE_EXIST changed between NetExpress 5.1 and Visual Cobol 4.0


       01  status-code              pic 9(04) comp.

           call "CBL_CHECK_FILE_EXIST" using file-name-1
                                   returning status-code


Value if file is not found:

In NetExpress x"0d39" or 9/013.

Now in Visual Cobol x"11fd".

Is there any help or guidance - why this happens - and to deal with it?

I use also other "cbl_..._file" programs and I am migrating my application on Windows 7 x64. The application itself is 32bit.


  • Verified Answer

    Hi Weinberger4,

    I created a simple test program using Visual COBOL 4.0 and that returned x"390d" (a decimal value of 14605) for a non-existent file. I think that what you are seeing is as a result of you using a pic 9(4) comp field which has a valid range of 0 to 9999 ie four decimal digits and therefore if you display it or move it to another item its value is truncated from 14605 to 4605 (or x"11fd"). Were you perhaps using the NOTRUNC compiler directive in Net Express but not in Visual COBOL ?

    As defined in the product documentation, the status-code should be a data item capable of holding a valid between 0 and 65535 eg pic 9(4) comp-5.

    I hope that helps,


  • Hi Gael,

    I have changed status-code to pic s9(09) comp-5,
    as it is stated in cbltypes.cpy (from Micro Focus) for 32bit cbl-rtncode.

    I didn't use the NOTRUNC compiler directive.

    Thank you for your efforts.