Previous Topic: Returning a Job's Exit Status to the Scheduling ManagerNext Topic: Send a User-Defined Exit Code


Send a Program's Return Code

When a job completes, the agent sends the job's exit code to the scheduling manager. By default, the agent sends the job's ending severity code as the job's exit code.

Instead of sending the job's ending severity code, the agent can send the return code of one of the following:

For example, if your job runs an ILE C, ILE RPG, OPM RPG, or OPM Cobol program that contains an exit or return statement, the agent sends that return code as the exit code.

To send a program's return code instead of the job's ending severity code, specify the CCEXIT statement with the value *USER (for an ILE program or module) or *PROGRAM (for an OPM program) in your job definition.

Example: Send an OPM COBOL Program's Return Code as the Job's Exit Code

This example runs an OPM COBOL program named PAYROLL. The agent sends the PAYROLL program's return code to the scheduling manager.

AGENT I5AG
CLPNAME PAYROLL
CCEXIT *PROGRAM

Example: Send an ILE C Program's Return Code as the Job's Exit Code

This example runs a C language program named SALARY. The agent sends the SALARY program's return code to the scheduling manager. Ending severity codes of 0 (zero) or 10 indicate job success.

AGENT I5AG
CLPNAME SALARY
CCEXIT *USER
EXITCODE 10 SUCCESS
EXITCODE 0 SUCCESS

Note: The i5 system always writes the job's ending severity code to the job's spool file. You can check the spool file for the job's ending severity code for more information about the job status. For example, suppose that the C program's return code indicates failure, but the ending severity code shown in the spool file is 10, which might indicate that the job ran with a minor issue. Assuming that this issue can be ignored, you can indicate ending severity codes of 10 as job success using the EXITCODE statement.