Previous Topic Next topic Print topic


Handling Return Codes in Mixed Language Applications

COBOL can pass and receive return codes from other programs.
Restriction: The following applies to native COBOL only.

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.

The registers used to pass the return code from COBOL and Microsoft C are:

32-bit Intel Return Code Size Register
One byte AL
Two bytes AX
Four bytes EAX
X64 Return Code Size Register
One, two, and four bytes as for X86
Eight bytes RAX
IA64 Return Code Size Register
Any size R8
Previous Topic Next topic Print topic