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:
- To receive a return code from a non-COBOL program, use the RETURNING phrase in the CALL statement in the calling COBOL program.
- To pass a return code back from a COBOL program, use the RETURNING phrase of the EXIT PROGRAM, GOBACK, or STOP RUN statement.
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.