Handling Return Codes in Mixed Language Applications

Most languages are capable of passing a return code back to the calling program. COBOL can pass and receive them as follows:

The RETURNING phrase enables you to define the format of the return code yourself and so cope with whatever size of return code you require.

Note that, the operating system limits the return value to two bytes, if you use the IF ERRORLEVEL syntax to check the return value.