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:
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.
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.
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.
Each JCL statement consists of the following fields:
Always starts with //
Names the statement
Specifies JOB, EXEC, DD, etc.
Contains parameters specific to the operation
Optional field after the operands, starting with a space
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.
Below is a simple COBOL program that could be executed using JCL:
123456789101112IDENTIFICATION 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.