Appendix D: JCL Quick Reference

Overview

Job Control Language (JCL) is the command language used on IBM mainframes to communicate with the operating system (z/OS). JCL tells the system which programs to execute, which files to use, and how to handle output. Every COBOL batch program on a mainframe is executed through JCL.

JCL Statement Format

All JCL statements begin in column 1 with a double slash (//). The general format is:

//name     operation    operand(s)    comments
  • Columns 1-2: Must contain // (or /* for delimiter statements)
  • Name field: 1-8 alphanumeric characters starting with a letter or national character
  • Operation field: JOB, EXEC, DD, or other JCL statement keyword
  • Operand field: Parameters separated by commas (no embedded spaces)
  • Continuation: Code a comma after the last parameter on the line, then continue in columns 4-16 of the next line

1. JOB Statement

The JOB statement marks the beginning of a job and specifies accounting and scheduling information.

//jobname  JOB  (accounting-info),programmer-name,parameters

JOB Statement Parameters

Parameter Format Description
CLASS CLASS=class Job class (A-Z, 0-9) determining execution priority and resource allocation
MSGCLASS MSGCLASS=class Output class for job messages (JES log); typically A (print) or X (held)
MSGLEVEL MSGLEVEL=(stmt,msg) Controls JCL listing: stmt (0=JOB only, 1=all JCL, 2=input only), msg (0=no allocation msgs, 1=all msgs)
NOTIFY NOTIFY=userid TSO user ID to be notified when the job completes
REGION REGION=nK|nM Virtual storage limit for the job; 0M means unlimited
TIME TIME=(mm,ss)|NOLIMIT Maximum CPU time; NOLIMIT removes time restriction
TYPRUN TYPRUN=SCAN|HOLD|COPY SCAN checks JCL syntax without execution; HOLD holds job for release
COND COND=(code,operator) Job-level condition code test for step bypass (see note below)
RESTART RESTART=stepname Restart the job from a specific step
PRTY PRTY=n Job selection priority (0-15, higher runs first)
SCHENV SCHENV=name WLM scheduling environment for workload management

Example JOB Statement

//PAYROLL  JOB (ACCT01,DEPT55),'J SMITH',
//         CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1),
//         NOTIFY=&SYSUID,REGION=0M,TIME=30

2. EXEC Statement

The EXEC statement identifies the program or procedure to execute within a job step.

//stepname EXEC PGM=program-name,parameters
//stepname EXEC PROC=procedure-name,parameters

EXEC Statement Parameters

Parameter Format Description
PGM PGM=program-name Name of the program to execute (from load library)
PROC PROC=proc-name Name of the cataloged or in-stream procedure to invoke
PARM PARM='string' Parameter string passed to the program (max 100 chars)
REGION REGION=nK|nM Virtual storage limit for this step (overrides JOB level)
TIME TIME=(mm,ss) CPU time limit for this step
COND COND=(code,op,stepname) Condition code test; skip this step if condition is true
ACCT ACCT=accounting Step-level accounting information
DYNAMNBR DYNAMNBR=n Number of dynamically allocated datasets

COND Parameter Logic

The COND parameter tests the return code from previous steps. The step is bypassed (not executed) when the condition is true.

Operator Meaning Example Step is skipped when...
GT Greater than COND=(4,GT,STEP01) STEP01 return code > 4
GE Greater or equal COND=(4,GE,STEP01) STEP01 return code >= 4
EQ Equal COND=(0,EQ,STEP01) STEP01 return code = 0
LT Less than COND=(8,LT,STEP01) STEP01 return code < 8
LE Less or equal COND=(8,LE,STEP01) STEP01 return code <= 8
NE Not equal COND=(0,NE,STEP01) STEP01 return code != 0

Important: COND parameter logic is inverted from what many programmers expect. COND=(4,LT) means "skip this step if 4 is less than any previous return code" (i.e., if any prior step returned greater than 4).

Example EXEC Statement

//STEP01   EXEC PGM=COBPROG1,PARM='PROD',
//         REGION=64M,TIME=(5,0),
//         COND=(4,LT)

3. DD Statement

The DD (Data Definition) statement defines datasets (files) used by a program step.

//ddname   DD   parameters

DD Statement Parameters

Parameter Format Description
DSN / DSNAME DSN=dataset.name The dataset name (up to 44 characters, segments up to 8 chars separated by periods)
DISP DISP=(status,normal,abnormal) Dataset disposition (see below)
SPACE SPACE=(unit,(primary,secondary,directory)) Space allocation for new datasets
DCB DCB=(RECFM=xx,LRECL=n,BLKSIZE=n) Data control block attributes
UNIT UNIT=device-type Device type (e.g., SYSDA for disk, TAPE for tape)
VOL VOL=SER=volume Specific volume serial number
SYSOUT SYSOUT=class Directs output to JES spool (class A=print, *=MSGCLASS)
DUMMY DUMMY Simulates I-O without actual data (useful for testing)
* (inline data) Marks the beginning of in-stream data (ended by /*)
DATA DATA Like * but allows // in data lines
LIKE LIKE=model-dsn Copies DCB attributes from an existing dataset
RECORG RECORG={KS|ES|RR|LS} VSAM record organization (KSDS, ESDS, RRDS, Linear)

DISP Parameter Values

Position Value Meaning
Status (1st) NEW Create a new dataset
OLD Existing dataset; exclusive access
SHR Existing dataset; shared access
MOD Append to existing or create new if not found
Normal disp (2nd) DELETE Delete the dataset at step completion
KEEP Keep the dataset (but do not catalog)
PASS Pass the dataset to subsequent steps
CATLG Catalog the dataset (add to system catalog)
UNCATLG Remove from catalog but keep on volume
Abnormal disp (3rd) DELETE Delete if the step abends
KEEP Keep if the step abends
CATLG Catalog if the step abends
UNCATLG Uncatalog if the step abends

Common DISP combinations:

DISP Usage
DISP=(NEW,CATLG,DELETE) Create new, catalog on success, delete on failure
DISP=SHR Open existing shared dataset (shorthand for (SHR,KEEP,KEEP))
DISP=OLD Open existing with exclusive access (shorthand for (OLD,KEEP,KEEP))
DISP=MOD Append to existing or create new
DISP=(NEW,PASS) Create new and pass to next step
DISP=(OLD,DELETE) Open existing and delete after step

SPACE Parameter

SPACE=(unit,(primary,secondary,directory),RLSE,CONTIG,ROUND)
Component Values Description
unit TRK Allocate in tracks
CYL Allocate in cylinders
block-size Allocate in blocks of specified size
primary integer Primary space allocation
secondary integer Secondary extent allocation (up to 15 extents)
directory integer PDS directory blocks (omit for sequential files)
RLSE RLSE Release unused space when file is closed
CONTIG CONTIG Require contiguous space allocation
ROUND ROUND Round to cylinder boundary when using block-size

Examples:

SPACE=(CYL,(10,5),RLSE)             Sequential file: 10 primary, 5 secondary cylinders
SPACE=(TRK,(100,50,10))             PDS: 100 tracks primary, 50 secondary, 10 dir blocks
SPACE=(27920,(500,100),RLSE,ROUND)  Block allocation rounded to cylinder boundary

DCB Parameter

DCB=(RECFM=xx,LRECL=nnnn,BLKSIZE=nnnnn)
Sub-parameter Values Description
RECFM F Fixed-length records
FB Fixed-length blocked records
V Variable-length records
VB Variable-length blocked records
FBA Fixed blocked with ANSI control characters
VBA Variable blocked with ANSI control characters
U Undefined-length records
LRECL integer Logical record length in bytes
BLKSIZE integer Block size in bytes (omit for system-determined optimal)
DSORG PS|PO|DA Dataset organization: Physical Sequential, Partitioned, Direct Access

Common DCB examples:

DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920)     Standard 80-byte card-image file
DCB=(RECFM=FB,LRECL=133,BLKSIZE=27930)     Print file with 133-byte records
DCB=(RECFM=VB,LRECL=32756,BLKSIZE=32760)   Variable-length blocked file

4. IF/THEN/ELSE/ENDIF

The IF/THEN/ELSE construct provides a clearer alternative to the COND parameter for conditional step execution.

//name     IF (condition) THEN
//stepname EXEC ...
//         ...
//name     ELSE
//stepname EXEC ...
//         ...
//name     ENDIF

Condition Syntax

stepname.RC  operator  value
Operator Meaning
GT or > Greater than
GE or >= Greater than or equal
EQ or = Equal
LT or < Less than
LE or <= Less than or equal
NE or != Not equal

Logical Operators

Operator Meaning
AND or & Both conditions must be true
OR or | Either condition must be true
NOT or ~ Negates the condition

Examples

//CHK1     IF (STEP01.RC = 0) THEN
//STEP02   EXEC PGM=NEXTPROG
//         ...
//CHK1     ELSE
//ERRSTEP  EXEC PGM=ERRHANDL
//         ...
//CHK1     ENDIF

//CHK2     IF (STEP01.RC <= 4 AND STEP02.RC = 0) THEN
//STEP03   EXEC PGM=FINALPGM
//CHK2     ENDIF

5. PROC and PEND

Procedures (PROCs) are reusable sets of JCL statements that can be parameterized and invoked from multiple jobs.

Cataloged Procedure

//procname PROC parameter=default,...
//STEP01   EXEC PGM=&PROGRAM
//INPUT    DD   DSN=&INFILE,DISP=SHR
//OUTPUT   DD   DSN=&OUTFILE,
//              DISP=(NEW,CATLG,DELETE),
//              SPACE=(CYL,(10,5),RLSE)
//         PEND

Invoking a Procedure

//STEP01   EXEC PROC=procname,PROGRAM=MYPROG,
//              INFILE=MY.INPUT.FILE,
//              OUTFILE=MY.OUTPUT.FILE

Overriding DD Statements in a PROC

//STEP01   EXEC PROC=MYPROC
//STEP01.INPUT DD DSN=OVERRIDE.INPUT.FILE,DISP=SHR

The format for overrides is stepname.ddname where stepname is the step within the PROC.

Symbolic Parameters

Feature Syntax Example
Define with default &param=default &ENV=PROD
Define without default &param= &DATE=
Reference in PROC &param DSN=&ENV..DATA.FILE
System symbols &SYSUID, &SYSDATE NOTIFY=&SYSUID
Double period &param..text &HLQ..MASTER.FILE (period is part of DSN)

6. Common Utility Programs

IEBGENER — Sequential File Copy

//COPY     EXEC PGM=IEBGENER
//SYSUT1   DD   DSN=input.file,DISP=SHR
//SYSUT2   DD   DSN=output.file,DISP=(NEW,CATLG,DELETE),
//              SPACE=(CYL,(10,5),RLSE),
//              DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920)
//SYSPRINT DD   SYSOUT=*
//SYSIN    DD   DUMMY

Use SYSIN DD DUMMY for a straight copy. Provide SYSIN control statements for record selection and reformatting.

IEBCOPY — PDS Copy/Compress

//* COPY MEMBERS FROM ONE PDS TO ANOTHER
//COPYSTEP EXEC PGM=IEBCOPY
//SYSUT3   DD   UNIT=SYSDA,SPACE=(CYL,(5,1))
//SYSUT4   DD   UNIT=SYSDA,SPACE=(CYL,(5,1))
//SYSPRINT DD   SYSOUT=*
//INDD     DD   DSN=source.pds,DISP=SHR
//OUTDD    DD   DSN=target.pds,DISP=SHR
//SYSIN    DD   *
  COPY OUTDD=OUTDD,INDD=INDD
  SELECT MEMBER=(MEMBER1,MEMBER2,MEMBER3)
/*

//* COMPRESS A PDS IN PLACE
//COMPRESS EXEC PGM=IEBCOPY
//SYSUT3   DD   UNIT=SYSDA,SPACE=(CYL,(5,1))
//SYSUT4   DD   UNIT=SYSDA,SPACE=(CYL,(5,1))
//SYSPRINT DD   SYSOUT=*
//MYPDS    DD   DSN=my.pds.library,DISP=OLD
//SYSIN    DD   *
  COPY OUTDD=MYPDS,INDD=MYPDS
/*

IDCAMS — Access Method Services (VSAM)

//* DEFINE A VSAM KSDS CLUSTER
//DEFVSAM  EXEC PGM=IDCAMS
//SYSPRINT DD   SYSOUT=*
//SYSIN    DD   *
  DEFINE CLUSTER (                          -
           NAME(MY.VSAM.CLUSTER)            -
           INDEXED                          -
           RECORDSIZE(200 200)              -
           KEYS(10 0)                       -
           SHAREOPTIONS(2 3)                -
           FREESPACE(20 10)                 -
         )                                  -
         DATA (                             -
           NAME(MY.VSAM.CLUSTER.DATA)       -
           CYLINDERS(10 5)                  -
           CONTROLINTERVALSIZE(4096)        -
         )                                  -
         INDEX (                            -
           NAME(MY.VSAM.CLUSTER.INDEX)      -
           CYLINDERS(2 1)                   -
         )
/*

//* DELETE A VSAM CLUSTER
//DELVSAM  EXEC PGM=IDCAMS
//SYSPRINT DD   SYSOUT=*
//SYSIN    DD   *
  DELETE MY.VSAM.CLUSTER CLUSTER PURGE
  SET MAXCC = 0
/*

//* REPRO (COPY DATA INTO VSAM)
//LOADVSAM EXEC PGM=IDCAMS
//INFILE   DD   DSN=my.sequential.file,DISP=SHR
//OUTFILE  DD   DSN=my.vsam.cluster,DISP=SHR
//SYSPRINT DD   SYSOUT=*
//SYSIN    DD   *
  REPRO INFILE(INFILE) OUTFILE(OUTFILE)
/*

//* LISTCAT (LIST CATALOG INFORMATION)
//LISTCAT  EXEC PGM=IDCAMS
//SYSPRINT DD   SYSOUT=*
//SYSIN    DD   *
  LISTCAT ENTRIES(MY.VSAM.CLUSTER) ALL
/*

//* VERIFY (FIX IMPROPERLY CLOSED VSAM FILE)
//VERIFY   EXEC PGM=IDCAMS
//SYSPRINT DD   SYSOUT=*
//MYCLUST  DD   DSN=MY.VSAM.CLUSTER,DISP=SHR
//SYSIN    DD   *
  VERIFY FILE(MYCLUST)
/*

DFSORT (ICEMAN) — Sort/Merge Utility

//SORT     EXEC PGM=SORT
//SORTIN   DD   DSN=input.file,DISP=SHR
//SORTOUT  DD   DSN=output.file,DISP=(NEW,CATLG,DELETE),
//              SPACE=(CYL,(10,5),RLSE),
//              DCB=(RECFM=FB,LRECL=80)
//SYSOUT   DD   SYSOUT=*
//SYSIN    DD   *
  SORT FIELDS=(1,10,CH,A,11,5,ZD,D)
  INCLUDE COND=(15,2,CH,EQ,C'NY')
  OUTREC FIELDS=(1,20,30,10,50,5)
/*

DFSORT Control Statements

Statement Description Example
SORT Sort fields definition SORT FIELDS=(1,10,CH,A)
MERGE Merge fields definition MERGE FIELDS=(1,10,CH,A)
INCLUDE Include records matching condition INCLUDE COND=(5,2,CH,EQ,C'NY')
OMIT Omit records matching condition OMIT COND=(5,2,CH,EQ,C'XX')
INREC Reformat input records INREC FIELDS=(1,20,40,10)
OUTREC Reformat output records OUTREC FIELDS=(1,20,C' ',21,10)
SUM Summarize numeric fields SUM FIELDS=(21,8,ZD)
OUTFIL Multiple output files with filtering OUTFIL FNAMES=OUT1,INCLUDE=...
OPTION Processing options OPTION COPY (copy without sorting)

Sort Field Data Types

Code Type Description
CH Character EBCDIC character data
ZD Zoned decimal Display numeric (USAGE DISPLAY)
PD Packed decimal USAGE COMP-3 / PACKED-DECIMAL
BI Binary USAGE BINARY / COMP
FI Fixed-point integer Signed binary integer
FL Floating-point COMP-1 or COMP-2

7. Common JCL Error Messages

Message ID Meaning Corrective Action
IEF212I Dataset not found on volume Verify DSN spelling and catalog entry. Run LISTCAT.
IEF257I Dataset not found in catalog Verify DSN and check if dataset was deleted.
IEF272I Step was not executed (COND) Review COND parameters or IF/THEN conditions.
IEF285I Dataset disposition information Informational — shows dataset was kept, deleted, or cataloged.
IEF453I Job failed — JCL error Review the preceding JCL error messages for specifics.
IEF613I Duplicate dataset name Another dataset with the same name already exists. Delete or rename.
IEF631I Insufficient space on volume Increase SPACE, use different volume, or free space.
IEFC001I Misplaced DD statement Verify DD statement follows its EXEC statement.
IEFC452I Symbolic parameter not defined Define the symbolic parameter in the PROC statement or provide a value.
IEFC621I Unbalanced parentheses Check parameters for matching parentheses.
IEFC630I Unidentified keyword Spelling error in a JCL parameter. Check keyword name.
IEFC632I Invalid value for keyword The value specified for a parameter is not valid.
IEC030I I-O error on dataset Check device, verify dataset integrity.
IEC141I Dataset not found (OPEN) Verify DD statement and dataset name.
IEC149I OPEN failure — attribute conflict DCB attributes conflict between JCL and program.
S001 I-O error during read/write Check dataset integrity. Verify DCB parameters match the file.
S013 Record length or block conflict LRECL or BLKSIZE in program does not match JCL or actual file.
S0C4 Protection exception (addressing) Program referenced invalid storage. Debug the program.
S0C7 Data exception Non-numeric data in numeric field. Validate input data.
S222 Job was cancelled by operator or TIME exceeded Increase TIME parameter or investigate why job was cancelled.
S322 Step exceeded CPU time limit Increase TIME on EXEC statement. Check for infinite loops.
S722 SYSOUT dataset exceeded output limit Increase output limit or reduce output volume.
S806 Load module not found Verify PGM name. Check STEPLIB/JOBLIB DD for correct library.
S837 Dataset exceeded space allocation Increase SPACE primary and secondary allocations.
S913 Security authorization failure (RACF) Request access from security administrator.
SB37 End of volume — no more space Increase SPACE allocation. Add secondary extents.
SD37 No secondary space specified Add secondary extent to SPACE parameter.
SE37 Maximum extents reached Allocate more primary space. Compress and reallocate the dataset.

8. Dataset Naming Rules

  1. Maximum total length: 44 characters
  2. Composed of qualifiers separated by periods
  3. Each qualifier: 1-8 characters
  4. First character of each qualifier: A-Z, @, #, or $
  5. Remaining characters: A-Z, 0-9, @, #, $, or hyphen
  6. No embedded blanks
  7. High-level qualifier (HLQ) typically corresponds to the owner's user ID or a system-defined prefix
  8. Common conventions: - HLQ.PROJECT.TYPE.name (e.g., PROD.PAYROLL.DATA.MASTER) - GDG format: DSN.NAME(+1) for next generation, (0) for current, (-1) for previous

9. DD Name Conventions

DD Name Typical Use
SYSIN Control statements or program input
SYSOUT Program messages or utility output
SYSPRINT Print output or utility messages
SYSUDUMP Formatted dump of user storage areas on abend
SYSABEND Formatted dump of both system and user storage on abend
CEEDUMP Language Environment formatted dump
SYSUT1-SYSUT9 Work files for utility programs
SORTIN Input file for DFSORT
SORTOUT Output file for DFSORT
SORTWKnn Sort work files (SORTWK01 through SORTWK09)
STEPLIB Step-level load library search (overrides system LINKLIST)
JOBLIB Job-level load library search

JCL is essential for running COBOL programs in a mainframe batch environment. Mastering JCL is as important as mastering COBOL itself for productive mainframe development.