Introduction
The JOB statement is the very first line of any batch job, defining the job’s name, accounting information, and default controls for how the entire job is processed. It tells the system who “owns” the work, where to charge CPU and I/O costs, and which default settings (class, message routing, time limits) to apply.
Immediately following the JOB statement, each EXEC statement marks the start of a discrete step—calling a program or procedure, passing any needed parameters, and setting step-specific controls such as TIME or REGION.
Together, the JOB and EXEC statements form the skeleton of every JCL script: JOB sets the global context, and EXEC breaks the work into manageable, independently controlled units.
Correct use of JOB and EXEC parameters ensures that your work runs in the right environment, uses appropriate resources, and provides the level of logging and control you need. By mastering these two statements, you gain precise control over batch processing behavior, making your jobs predictable, efficient, and easy to maintain.
IBM Docs - Learn How to create and Submit JCL.
Here are the detail about each parameter coded in JOB and Exec:
Positional vs. Keyword Parameters
JCL parameters look similar but behave very differently depending on position. A misplaced comma or missing keyword can change meaning—or cause errors.
- Positional parameters come first (inside parentheses) and have a fixed order.
- e.g. on
//MYJOB JOB (ACCT123),'Desc'…
the(ACCT123)
is positional. - You cannot mix order:
(ACCT123,'DEPT')
≠('DEPT',ACCT123)
.
- e.g. on
- Keyword parameters follow, each as
NAME=value
and in any order.- e.g.
CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID
- e.g.
- Common mistakes:
- Omitting parentheses around positional list:
JOB ACCT123,…
is invalid. - Writing
MSGLEVEL=1,1
instead ofMSGLEVEL=(1,1)
. - Putting a keyword too early (before all positional): system will treat it as a bad positional value.
- Omitting parentheses around positional list:
- Tip: Always code all your positional values together in one
(…)
, then a comma, then all keywords.
MSGLEVEL: Parentheses, Sub-options & Common Mistakes
MSGLEVEL has two parts—what JCL you see vs. what messages you see—and both must be in (…)
.
- Syntax:
MSGLEVEL=(statements,messages)
- statements (first position):
0
= only JOB statement + initial comments1
= all JCL (including procedures) after symbol substitution2
= only JCL & JES control
- messages (second position):
0
= only JCL messages; other messages only on failure1
= all messages (JCL, JES, operator, SMS)
- statements (first position):
- Examples:
MSGLEVEL=(1,1)
→ full JCL + all messagesMSGLEVEL=(2,0)
→ only control statements; only JCL messages unless failureMSGLEVEL=1
→ shorthand for(1,0)
MSGLEVEL=(,1)
→ use default statements, but show all messages
- Common mistakes:
- Missing parentheses:
MSGLEVEL=1,1
→ syntax error - Dropping comma:
MSGLEVEL=(11)
→ interpreted as statements=11 (invalid)
- Missing parentheses:
- Tip: If you only need one sub-option, you can omit the other but keep the comma:
- To show all messages but default JCL:
MSGLEVEL=(,1)
- To show all messages but default JCL:
TYPRUN: SCAN vs. HOLD vs. “I Thought It’d Run…”
TYPRUN modes do not execute your code—they just queue it differently. SCAN does not run programs!
- TYPRUN=SCAN
- Performs JCL syntax check only.
- No program execution, no data allocation—just parser.
- TYPRUN=HOLD
- Submits the job but places it in “hold” status.
- An operator (or
/*HOLD
override) must release it.
- Common mistaken belief: TYPRUN=SCAN will “run it lightly” or “test it.” It never runs any step!
- Tip: If you need to test a job without full run, use SCAN—but remember nothing actually executes.
TIME Limits: JOB-level vs. STEP-level Interactions
JOB TIME and EXEC TIME are independent. Exceeding either limit will abend—even if the other has headroom.
- JOB TIME = total elapsed time for all steps.
- EXEC TIME = time per step.
- Syntax examples
//MYJOB JOB …,TIME=60
→ total 60 minutes for entire job//STEP1 EXEC PGM=…,TIME=(0,30)
→ 30 seconds for STEP1 only
- What actually happens:
- Job starts: JOB TIME countdown begins.
- Enter STEP1: STEP1 TIME countdown begins.
- STEP1 ends (if both limits not exceeded).
- Move to STEP2: new STEP2 countdown, but JOB TIME continuing.
- Common pitfall:
- You set STEP times generously but overlook JOB TIME.
- Example: JOB TIME=25s, two steps each TIME=20s. Step1 (15s) OK; Step2 starts, but 25s total exceeded → S322 abend.
- Tip: If your site’s default (usually 24 hrs) suffices, omit JOB TIME. Otherwise, plan both step durations and job total together.