The JOBRC parameter specifies what return code values are acceptable for a job to be considered successful. This parameter allows installations to define custom success criteria beyond the default assumption that only a return code of zero indicates success. JOBRC is particularly useful in automated job scheduling environments where subsequent jobs depend on the success status of previous jobs.
1//jobname JOB parameters,JOBRC=value
Value | Description |
---|---|
MAXRC | The job is considered successful only if the highest step completion code is 0 |
LASTRC | The job is considered successful only if the last step completion code is 0 |
nnn | A numeric value (0-4095) specifying the maximum return code value considered successful |
(MAXRC,nnn) | The job is considered successful if the highest step completion code doesn't exceed nnn |
(LASTRC,nnn) | The job is considered successful if the last step completion code doesn't exceed nnn |
12//TESTJOB JOB (ACCT),'JOHN DOE',CLASS=A, // MSGCLASS=X,JOBRC=MAXRC
This job will be considered successful only if all steps complete with a return code of 0.
12//TESTJOB JOB (ACCT),'JOHN DOE',CLASS=A, // MSGCLASS=X,JOBRC=LASTRC
This job will be considered successful if the final step completes with a return code of 0, regardless of previous steps.
12//TESTJOB JOB (ACCT),'JOHN DOE',CLASS=A, // MSGCLASS=X,JOBRC=4
This job will be considered successful if all steps complete with a return code of 4 or less.
12//TESTJOB JOB (ACCT),'JOHN DOE',CLASS=A, // MSGCLASS=X,JOBRC=(MAXRC,8)
This job will be considered successful if all steps complete with a return code of 8 or less.
12//TESTJOB JOB (ACCT),'JOHN DOE',CLASS=A, // MSGCLASS=X,JOBRC=(LASTRC,4)
This job will be considered successful if the final step completes with a return code of 4 or less, regardless of previous steps.
While return code meanings can vary by application, there are common conventions in many mainframe environments:
Return Code | Typical Meaning |
---|---|
0 | Successful execution, no issues |
4 | Warning, minor issue but processing continued |
8 | Error, significant issue but job continued |
12 | Serious error, processing may be incomplete |
16 | Fatal error, processing terminated |
The JOBRC parameter affects how the job is reported in various system interfaces and how job scheduling systems interpret the job's success status:
When a step abnormally terminates with a system completion code (ABEND), the JOBRC parameter doesn't apply. In these cases, the job is always considered unsuccessful.
While JOBRC affects how the job's success is interpreted, the COND parameter controls whether steps are executed based on previous return codes. These parameters serve different purposes:
Conditional JCL (IF/THEN/ELSE/ENDIF) provides finer control over step execution based on return codes within the job. JOBRC complements this by determining the overall job success status.
The JOBRC parameter behavior can vary slightly between JES2 and JES3 environments:
JES System | JOBRC Behavior |
---|---|
JES2 |
|
JES3 |
|
Note: With IBM's direction to consolidate on JES2, JES3-specific behavior is becoming less relevant over time.