MainframeMaster

JCL Tutorial

JCL Basics

Progress0 of 0 lessons

JCL Character Set

JCL has a restricted character set compared to modern programming languages. Understanding these limitations is essential for writing valid JCL statements.

Valid JCL Characters

Alphanumeric Characters:

  • Letters: A-Z (uppercase only)
  • Numbers: 0-9

Special Characters:

  • @ # $ , . / ' ( ) - + * & % = ;
  • Blank space

Character Restrictions:

  • Lowercase letters are not recognized (they're converted to uppercase)
  • Some special characters have specific meanings in JCL
  • National language characters may be valid depending on system configuration

The limited character set reflects JCL's origins in the 1960s when computing systems had more restricted character encoding support.

JCL Naming Conventions

Names in JCL follow specific rules that must be adhered to for valid execution:

Job Names

  • 1-8 alphanumeric or national characters (@, #, $)
  • First character must be alphabetic (A-Z) or national
  • Must be unique within the system for active jobs
  • Examples: PAYROLL, TEST01, $BACKUP

Step Names

  • 1-8 alphanumeric or national characters
  • First character must be alphabetic (A-Z) or national
  • Must be unique within a job
  • Examples: STEP01, COMPILE, SORT

DD Names

  • 1-8 alphanumeric or national characters
  • First character must be alphabetic (A-Z) or national
  • Must be unique within a step
  • Some DD names are reserved for system use (JOBLIB, STEPLIB, etc.)
  • Examples: INPUT, OUTPUT, SORTIN

Dataset Names

  • 1-44 characters divided into qualifiers (nodes) separated by periods
  • Each qualifier must be 1-8 alphanumeric or national characters
  • First character of each qualifier must be alphabetic or national
  • Examples: SYS1.PROCLIB, USER.COBOL.SOURCE

Statement Formatting Rules

JCL statements follow a rigid format based on their position within a card column structure, a legacy of the punched card era:

JCL Statement Fields

FieldColumnsPurpose
Identifier Field1-2Contains // for JCL statements or //* for comments
Name Field3-10Contains the name of the statement (jobname, stepname, ddname)
Operation Field12-71Contains the operation (JOB, EXEC, DD) and begins with the first non-blank character after the name field
Operand Field12-71Contains parameters after the operation, separated by commas
Comments Field12-71Optional comments added after the operands, separated by at least one space
Continuation Column72When 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 in JCL

Comments are essential for documenting JCL and can be added in several ways:

Comment Statements

A full-line comment begins with //* in columns 1-3:

jcl
1
2
3
//* 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.

Inline Comments

Comments can be added to the end of a JCL statement after at least one blank space:

jcl
1
2
//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.

Comment Blocks

Multiple comment lines are often used to create visual separation or documentation blocks:

jcl
1
2
3
4
5
6
7
//********************************************* //* * //* 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.

JCL Statement Continuation

When JCL statements are too long to fit on a single line, they can be continued using specific techniques:

Traditional JCL Continuation

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:

jcl
1
2
//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.

Continuation Rules

  • Statements can be split only after a complete parameter or comma
  • Quoted strings cannot be split across lines
  • The continuation line must not have a name field (columns 3-10 must contain at least one blank)
  • The continuation starts at the first non-blank character in the continued line
  • Multiple continuations are allowed for a single statement

Modern JCL Continuation Example

A complete DD statement with multiple parameter continuations:

jcl
1
2
3
4
5
//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.

JCL Basics Example

Here's a complete JCL example that demonstrates the basic concepts covered in this tutorial:

jcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//********************************************* //* 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.