A return code can be returned using the Return code (RTNCDE) parameter on the Retrieve Job Attributes (RTVJOBA) command .
The return code is a 5-digit decimal value with no decimal positions (12345. for example). The decimal value indicates the status of called programs. CL programs do not set the return code. However, you can retrieve the current value of the return code as set by another program in a CL program. You can do this by using the RTNCDE parameter of the Retrieve Job Attributes (RTVJOBA) command.
The following list summarizes the return codes used by languages supported on the i5/OS® operating system:
The return codes sent by the RPG IV compiler are:
The return codes sent by running RPG IV programs are:
RPG IV return codes are tested only after a CALL:
The return code cannot be tested directly by the user in the RPG IV program.
The return codes sent by running COBOL programs are:
COBOL programs cannot retrieve these return codes. For OPM COBOL, a return code value of 2 sends message LBE9001. For ILE COBOL, a return code value of 2 sends message CEE9001.
The current value of the integer return code is returned by the last ILE C return statement in an ILE C program.