For COBOL

When a COBOL program initiates enclave termination, such as with a STOP RUN statement or a GOBACK statement in a main program, the user return code value is taken from the RETURN-CODE special register; any user return codes set through CEE3SRC are ignored. Likewise, in an ILC application, any user return codes set with PL/I language constructs are also ignored. Thus, you can set and alter the user return code and pass it across program boundaries in register 15. See the appropriate version of the programming guide in the COBOL library at Enterprise COBOL for z/OS library for more information about the RETURN-CODE special register and COBOL language constructs.

If the enclave terminates due to an unhandled condition with severity 2 or greater, the RETURN-CODE special register is not used in the enclave return code calculation. Instead, the user return code value used is the last one set by either CEE3SRC or, in an ILC application, PL/I language constructs. If neither CEE3SRC nor PL/I language constructs have been used to set the user return code, the user return code value is 0. See Termination behavior for unhandled conditions for information about unhandled conditions.