JCL INCLUDE
Statement – Reusing JCL Code Made Easy
In large batch jobs, you often repeat the same JCL steps across multiple jobs. The INCLUDE
statement helps avoid duplication by reusing JCL code stored in a PDS/PDSE library — just like using a subroutine in programming.
The INCLUDE
statement pulls in a set of JCL statements (called an INCLUDE group) from a library. This group can contain EXEC, DD, or other valid JCL statements.
You can store this group in:
- System PROCLIB (e.g.,
SYS1.PROCLIB
) - Installation-defined PROCLIB
- Private PDS/PDSE (linked using a
JCLLIB
statement)
Syntax
//[label] INCLUDE MEMBER=member-name [comments]
label
– Optional (1–8 characters)member-name
– Name of the PDS/PDSE member to include
📌 Rules to Remember
- The
INCLUDE
statement must come after the JOB statement. - If you use a
JCLLIB
statement, thenINCLUDE
must come after JCLLIB. - It must follow a complete JCL statement (can't be in the middle of one).
- The included member must be valid JCL — no syntax errors allowed!
🔍 Example
//MYSTEP INCLUDE MEMBER=DB2LOAD
- This line includes a member named
DB2LOAD
from a PDS/PDSE defined earlier. - That member may contain steps like:
//STEP1 EXEC PGM=IKJEFT01
//SYSTSIN DD *
DSN SYSTEM(DB2)
RUN PROGRAM(LOADIT) PLAN(LOADPLN) ...
/*
//SYSPRINT DD SYSOUT=*
✅ Benefits
- Reduces duplication
- Makes maintenance easier
- Keeps JCL jobs shorter and cleaner
- Promotes reuse of tested and approved code blocks
Submitting JCL Using Internal Reader (INTRDR
)
The Internal Reader (INTRDR) lets you submit one job from inside another job — fully automated and without manual input. It’s like JCL sending more JCL to be run
Why Use INTRDR?
- 🌀 Chain jobs automatically (e.g., Job A submits Job B after finishing).
- ⚙️ Automate dynamic workflows in scheduling systems like JES2, CA-7, Control-M.
- 📝 Dynamically create and submit jobs using COBOL, REXX, or other programs.
- 🔧 Run ad-hoc jobs without saving JCL permanently to disk.
How to Use INTRDR
You use SYSOUT=(*,INTRDR)
in a DD
statement to send JCL to the internal reader.
🧩 Key idea: Treat the job you want to submit as if you're printing it — but send it to INTRDR
instead.
Sample JCL to Submit Another Job
//SUBMIT1 EXEC PGM=IEBGENER
//SYSUT1 DD *
//SUBJOB JOB ...
//STEP1 EXEC PGM=IEFBR14
//*
//SYSUT2 DD SYSOUT=(*,INTRDR)
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
SYSUT1
: Contains the JCL lines to be submitted (like//SUBJOB JOB...
)SYSUT2
: Sends the content to the INTRDRIEBGENER
: A utility to copy data (used here to pass JCL to INTRDR)
📌 What Happens
- The job
SUBMIT1
runs. - It writes JCL into
SYSUT2
, but instead of printing it, it sends it to INTRDR. - The system reads and submits this new JCL as if you typed it manually.
🚦 Things to Note
- Great for automated, dependent, or scheduled processing.
- Be careful — if the included JCL has errors, it still gets submitted and may fail.
- You must ensure correct permissions to submit jobs dynamically.
JCL Control Statements for System Control
JCL (Job Control Language) System Control Statements are special commands used to control job execution, routing, output handling, and system interactions in IBM JES2 and JES3 environments. These statements help direct jobs within a multi-system network, control execution priority, and manage system resources.
These are special instructions that control how the operating system manages a job — not what the job does, but how it's handled.
IBM Docs - JES2 Control statement
IBM Docs - JES3 Control statement
Commonly Used JCL System Commands: /*ROUTE
and /*XEQ
In a SYSPLEX environment (where multiple mainframes are connected and share workload), you may want to send output or run jobs on a different system. JCL provides special commands to do that: /*ROUTE
and /*XEQ
.
/*ROUTE
Statement
Used to send output or execute a job on a specific system or printer.
Key Uses:
/*ROUTE PRINT
→ Send printed output to a specific remote terminal./*ROUTE XEQ
→ Send the job for execution to a specific node (system).
Examples:
/*ROUTE PRINT RMT6
- Sends printed output to Remote Terminal 6.
/*ROUTE XEQ NODE2
- Sends the job to NODE2 for execution after JCL is checked.
/*XEQ
Statement
Used to submit a job for execution on another system.
It does the same job as /*ROUTE XEQ
, just a different way to write it.
Example:
/*XEQ NODE2
- Sends the job to NODE2 for execution after JCL syntax check.
Important Notes
- These statements are used only in SYSPLEX or multi-system JES environments.
- Do not use
/*ROUTE XEQ
or/*XEQ
for started tasks. If you do, JES2 will fail the job.