You can use the RETURN-CODE special register to pass and receive return codes between ILE COBOL programs. You can set the RETURN-CODE special register before returning from a called ILE COBOL program.
When used in nested programs, the RETURN-CODE special register is implicitly defined as GLOBAL in the outermost ILE COBOL program. Any changes made to the RETURN-CODE special register is global to all ILE COBOL programs within the module object.
When an ILE COBOL program returns to its caller, the contents of its RETURN-CODE special register are transferred into the RETURN-CODE special register of the calling program.
When control is returned from a main ILE COBOL program to the operating system, the RETURN-CODE special register contents are returned as a user return code.
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.