JCL has a restricted character set compared to modern programming languages. Understanding these limitations is essential for writing valid JCL statements.
Alphanumeric Characters:
Special Characters:
Character Restrictions:
The limited character set reflects JCL's origins in the 1960s when computing systems had more restricted character encoding support.
Names in JCL follow specific rules that must be adhered to for valid execution:
PAYROLL
, TEST01
, $BACKUP
STEP01
, COMPILE
, SORT
INPUT
, OUTPUT
, SORTIN
SYS1.PROCLIB
, USER.COBOL.SOURCE
JCL statements follow a rigid format based on their position within a card column structure, a legacy of the punched card era:
Field | Columns | Purpose |
---|---|---|
Identifier Field | 1-2 | Contains // for JCL statements or //* for comments |
Name Field | 3-10 | Contains the name of the statement (jobname, stepname, ddname) |
Operation Field | 12-71 | Contains the operation (JOB, EXEC, DD) and begins with the first non-blank character after the name field |
Operand Field | 12-71 | Contains parameters after the operation, separated by commas |
Comments Field | 12-71 | Optional comments added after the operands, separated by at least one space |
Continuation Column | 72 | When containing any non-blank character, indicates statement continues on next line |
While modern JCL editors don't enforce the column positioning strictly, adhering to these formatting rules ensures compatibility and readability.
Comments are essential for documenting JCL and can be added in several ways:
A full-line comment begins with //*
in columns 1-3:
123//* THIS IS A FULL-LINE COMMENT //* ANOTHER COMMENT LINE //STEP01 EXEC PGM=IEFBR14
Comment statements can appear anywhere in a JCL stream and are ignored by the system.
Comments can be added to the end of a JCL statement after at least one blank space:
12//STEP01 EXEC PGM=IEFBR14 This is an inline comment //DD1 DD DSN=MY.DATASET,DISP=SHR Comment after parameters
Inline comments must not contain commas, as these could be interpreted as parameter separators.
Multiple comment lines are often used to create visual separation or documentation blocks:
1234567//********************************************* //* * //* MONTHLY PAYROLL PROCESSING JOB * //* RUNS ON THE LAST DAY OF EACH MONTH * //* * //********************************************* //PAYROLL JOB (ACCT1),'PAYROLL DEPT',CLASS=A
Well-commented JCL is essential for maintenance, especially in production environments where jobs may be maintained by different staff members over many years.
When JCL statements are too long to fit on a single line, they can be continued using specific techniques:
Continuation is indicated by a non-blank character in column 72 and the continuation line starting with //
followed by at least one blank in column 3:
12//STEP01 EXEC PGM=IEFBR14,REGION=4M, X // PARM='ABC,DEF'
The character in column 72 (often 'X') is purely for visual indication and doesn't affect processing.
A complete DD statement with multiple parameter continuations:
12345//DD1 DD DSN=SYS1.VERY.LONG.DATASET.NAME, X // DISP=(NEW,CATLG,DELETE), X // SPACE=(CYL,(10,5),RLSE), X // DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920, X // DSORG=PS)
Modern JCL editors may visually represent continuations differently but must adhere to these rules when submitting to the system.
Here's a complete JCL example that demonstrates the basic concepts covered in this tutorial:
123456789101112131415161718192021222324//********************************************* //* SAMPLE JCL ILLUSTRATING BASIC CONCEPTS * //********************************************* //SAMPLE JOB (ACCT#),'JOHN SMITH',CLASS=A, // MSGCLASS=X,NOTIFY=&SYSUID //* //STEP01 EXEC PGM=IEFBR14 //* //DD1 DD DSN=USER.SAMPLE.DATA, // DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(5,2),RLSE), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=800) //* //STEP02 EXEC PGM=SORT This step will sort the data //* //SORTIN DD DSN=USER.SAMPLE.DATA,DISP=SHR //SORTOUT DD DSN=USER.SAMPLE.SORTED, // DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(5,2),RLSE), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=800) //SYSIN DD * SORT FIELDS=(1,10,CH,A) /* //*
This JCL example demonstrates proper naming, formatting, comments, and continuation techniques. It creates a new dataset in the first step and then sorts it in the second step.