JOBRC Parameter

Purpose

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.

Syntax

JOB Statement Format

jcl
1
//jobname JOB parameters,JOBRC=value

Parameter Values

value

ValueDescription
MAXRCThe job is considered successful only if the highest step completion code is 0
LASTRCThe job is considered successful only if the last step completion code is 0
nnnA 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

Usage Examples

Basic MAXRC Example

jcl
1
2
//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.

Basic LASTRC Example

jcl
1
2
//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.

Numeric Threshold Example

jcl
1
2
//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.

MAXRC with Threshold

jcl
1
2
//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.

LASTRC with Threshold

jcl
1
2
//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.

Common Return Code Conventions

While return code meanings can vary by application, there are common conventions in many mainframe environments:

Return CodeTypical Meaning
0Successful execution, no issues
4Warning, minor issue but processing continued
8Error, significant issue but job continued
12Serious error, processing may be incomplete
16Fatal error, processing terminated

JOBRC Processing

How JOBRC Works

The JOBRC parameter affects how the job is reported in various system interfaces and how job scheduling systems interpret the job's success status:

  1. JCL processing: The JOBRC parameter is validated during JCL validation
  2. Step processing: Return codes are collected from each job step as it completes
  3. Job completion: Based on the JOBRC parameter, the system determines if the job is successful
  4. Job scheduler interaction: Job schedulers and automation tools check the success status to determine if dependent jobs should be submitted

System-Determined Results

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.

Use Cases

Common Scenarios for Using JOBRC

  • Applications with known warnings: Some applications routinely return code 4 for minor warnings. Using JOBRC=4 allows these jobs to be considered successful
  • Multi-step process with cleanup: Use JOBRC=LASTRC when the final step is a cleanup operation, and earlier steps might have acceptable errors
  • Data validation jobs: Data validation programs often return graduated codes based on the severity of issues found. JOBRC allows specifying which severity levels are acceptable
  • Job dependencies: When jobs are part of a sequence or workflow, JOBRC ensures proper dependency handling in job schedulers
  • Reporting applications: Report generation programs might return non-zero codes for empty reports or minor formatting issues

Best Practices

  1. Document return code meanings for each application in your environment
  2. Be consistent with JOBRC usage across related job streams
  3. Consider using JOBRC=4 for production jobs as many utilities return code 4 for minor warnings
  4. Use JOBRC=MAXRC for critical jobs where any warning might indicate problems
  5. Avoid using high thresholds like JOBRC=12 without understanding application return codes
  6. Review job output regardless of JOBRC during testing to ensure proper behavior
  7. Standardize return code conventions in custom applications to align with system utilities

Interactions with Other JCL Parameters

COND Parameter

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:

  • JOBRC determines if the entire job is considered successful
  • COND determines if specific steps should be skipped based on condition tests

IF/THEN/ELSE/ENDIF Statements

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.

JES2 and JES3 Considerations

The JOBRC parameter behavior can vary slightly between JES2 and JES3 environments:

JES SystemJOBRC Behavior
JES2
  • Full support for all JOBRC options
  • Integration with JES2 condition code handling
  • Used by JES2 exit points for automation
JES3
  • Support for JOBRC options but may have implementation differences
  • Integration with JES3 job dependency features
  • May be interpreted differently by JES3 job schedulers

Note: With IBM's direction to consolidate on JES2, JES3-specific behavior is becoming less relevant over time.

Related Concepts