The return code (RTNCDE) parameter on the RTVJOBA command 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 RTVJOBA command.
The following list summarizes the return codes used by languages supported on OS/400:
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/400 programs are:
COBOL/400 programs cannot retrieve these return codes. A return code value of 2 sends message CBE9001 and runs a Reclaim Resources (RCLRSC) command with the *ABNORMAL option.
Compiled or interpreted BASIC programs can set the return code to any value between -32768 and 32767 by coding an expression on the END or STOP statements. If no expression is coded, the return codes are set to:
BASIC return code values can be retrieved using the CODE intrinsic function.
The return codes sent by PL/I programs are:
If any other value is found, it is set up by the PLIRETC built-in function or by a called procedure. PLIRETC passes a return code from the PL/I program to the program that called it, changing the current return code value.
PL/I programs can retrieve the return code using the PLIRETV built-in function.
The Pascal compiler sets the following return codes:
Pascal does not explicitly set the return code at run time. The user can use the ONERROR exception handling routine to monitor for particular exceptions, then set the return code using the RETCODE procedure.
Pascal return codes can be retrieved using the RETVALUE parameter of the Pascal SYSTEM procedure. The return code is set to 0 before the SYSTEM call and will contain the updated return code when returned.
The current value of the integer return code returned by the last C/400(R) return statement in a C/400 program.
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.