Simple Mainframe Universe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

JCL Troubleshooting


Return code differs between environments

Troubleshooting guide for Return code differs between environments. JCL syntax errors are caught before the job runs — the job never executes, and the message points at the offending statement.

What it means

  • JCL is positional and punctuation-sensitive: columns 1–2 for //, 3–10 for the name field, 12+ for operation, 17+ for parameters.
  • A JCL ERROR means the converter rejected the job; nothing ran, so there is no abend code — only converter messages like IEFC001I.
  • Most syntax failures are one-character problems: a missing comma, a parenthesis, or a continuation error.

Common causes

  • Missing comma between keyword parameters: DSN=X DISP=SHR on the same DD (needs a comma between them).
  • Unbalanced parentheses in DISP=(NEW,CATLG,DELETE) or SPACE=(TRK,(10,5)).
  • Continuation error: columns 1–3 of the continued line are not blank, or column 72 is exceeded, or the comma before continuation is missing.
  • JOB card rejected: accounting info, CLASS, or MSGCLASS invalid for the installation, or a missing comma after the job name.
  • EXEC PGM= names a program not in the STEPLIB/JOBLIB concatenation or system libraries — results in S806 at run time, not a JCL error.
  • IF/THEN/ELSE wrong branch: the condition tests the wrong step return code, e.g. IF RC > 4 tests the previous step only.
  • COND=(4,LT) on the EXEC skips the step when any previous step RC is less than 4 — COND logic is easy to invert by mistake.
  • Downstream step skipped because a previous step ended RC=8 and the EXEC has no COND override; the job "succeeds" with MAXCC=8.
  • MAXCC unexpectedly high: an earlier step abended and a later step ran anyway, or a utility returned 4 (warning) treated as failure.

How to diagnose

  • Read the JESMSGLG / JESJCL output: IEFC001I messages name the exact statement and column of the error.
  • For converter errors, view the job with SDSF and check the "JCL ERROR" line — it cites the statement name.
  • For IF/COND logic: list each step return code from the job log, then evaluate the IF condition against the actual RC of the previous step.
  • For MAXCC: scan every step RC in the log; the highest one sets MAXCC even if the job ended "normally".
  • Use ISPF option 3.8 or a JCL checker to validate syntax before submitting.

How to fix it

  • Add the missing comma or parenthesis exactly where IEFC001I points; resubmit — converter errors never need a code change.
  • Fix continuations: parameter ends with a comma, next line starts in column 4–16 with // in columns 1–2.
  • Correct COND logic: COND=(0,NE) runs the step only if a previous RC is not 0; draw the truth table before editing.
  • For IF/THEN/ELSE: remember IF tests the return code of the immediately preceding step unless named: //IF1 IF (STEP1.RC > 4) THEN.
  • Decide what MAXCC is acceptable and code COND/IF to match the intended flow, not the other way round.

Example: Correct JCL continuation and IF/THEN/ELSE

//STEP1 EXEC PGM=SORT //SORTIN DD DSN=APP.INPUT.FILE,DISP=SHR //SORTOUT DD DSN=APP.OUTPUT.FILE, // DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(10,5),RLSE), // DCB=(RECFM=FB,LRECL=80) //SYSOUT DD SYSOUT=* //IF1 IF (STEP1.RC > 4) THEN //STEP2 EXEC PGM=IEBGENER,COND=(0,NE) //ENDIF ENDIF

Continuation lines need // in columns 1-2 and a trailing comma; IF tests the previous step RC unless a step is named.

Interview tip

  • Q: A job ends with JCL ERROR and nothing runs. Return code differs between environments — how do you find it fast?
  • A: I open the JESMSGLG in SDSF and look for the IEFC001I message, which names the exact statement and the problem — usually a missing comma or bad continuation. JCL errors happen before execution, so there is never an abend code to chase.

Prevention checklist

  • Validate JCL with a syntax checker before every submit.
  • Keep one tested PROC per job family instead of hand-written JCL copies.
  • Comment non-obvious COND/IF logic with the intended truth table.
  • Review MAXCC expectations after every job change.




© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant