MainframeMaster

JCL Tutorial

JCL Structure

Progress0 of 0 lessons

Understanding JCL Structure

JCL (Job Control Language) follows a specific structure to control job execution on mainframe systems. A typical JCL job consists of three main statement types:

1. JOB Statement

The JOB statement marks the beginning of a job and provides identification information:

//JOBNAME JOB accounting-info, programmer-name, additional parameters

The JOB statement defines job attributes like priority, runtime limitations, and security parameters.

2. EXEC Statement

The EXEC statement invokes a program or procedure:

//stepname EXEC PGM=program-name or PROC=procedure-name

Multiple EXEC statements can exist within a single job, each representing a different processing step.

3. DD Statement

DD (Data Definition) statements identify datasets that will be used in a job step:

//ddname DD dataset-parameters

DD statements connect physical resources to the logical names that programs use to access them.

JCL Field Structure

Each JCL statement consists of the following fields:

Identifier Field (columns 1-2)

Always starts with //

Name Field (columns 3-10)

Names the statement

Operation Field (columns 12-14+)

Specifies JOB, EXEC, DD, etc.

Operand Field

Contains parameters specific to the operation

Comments Field

Optional field after the operands, starting with a space

JCL Continuation

When a JCL statement is too long to fit on one line, it can be continued:

//EXAMPLE DD DSN=MY.DATASET.NAME, X // DISP=(NEW,CATLG,DELETE), X // SPACE=(CYL,(10,5))

The continuation line must start with // followed by at least one blank in columns 3-16.

Example COBOL Program

Below is a simple COBOL program that could be executed using JCL:

cobol
1
2
3
4
5
6
7
8
9
10
11
12
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO-WORLD. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-MESSAGE PIC X(15) VALUE 'HELLO, WORLD!'. PROCEDURE DIVISION. DISPLAY WS-MESSAGE. STOP RUN.

This COBOL program would be referenced in the JCL's EXEC statement to execute it on the mainframe.