In this section, we will explore the fundamental JCL statements that form the backbone of any JCL job. Understanding these statements is crucial for writing and managing JCL scripts effectively.

Key JCL Statements

JCL primarily consists of three types of statements:

  1. JOB Statement
  2. EXEC Statement
  3. DD Statement

  1. JOB Statement

The JOB statement marks the beginning of a JCL job and provides information about the job to the operating system. It includes details such as job name, accounting information, and job-level parameters.

Syntax:

//JOBNAME JOB (accounting_info), 'job_description', CLASS=class, MSGCLASS=msgclass, ...

Example:

//MYJOB   JOB (12345), 'Sample Job', CLASS=A, MSGCLASS=X

Explanation:

  • MYJOB: The name of the job.
  • (12345): Accounting information.
  • 'Sample Job': Description of the job.
  • CLASS=A: Specifies the job class.
  • MSGCLASS=X: Specifies the message class for job output.

  1. EXEC Statement

The EXEC statement specifies the program or procedure to be executed. It can also pass parameters to the program.

Syntax:

//stepname EXEC PGM=program_name, PARM='parameters'

Example:

//STEP1   EXEC PGM=IEFBR14

Explanation:

  • STEP1: The name of the step.
  • PGM=IEFBR14: Specifies the program to be executed (IEFBR14 is a dummy program).

  1. DD Statement

The DD (Data Definition) statement describes the data sets used in the job. It specifies the input and output data sets, their attributes, and how they should be handled.

Syntax:

//ddname  DD  parameters

Example:

//SYSIN   DD  *
This is input data
/*

Explanation:

  • SYSIN: The name of the data definition.
  • DD *: Indicates that the data follows in-stream.
  • This is input data: The actual data.
  • /*: End of in-stream data.

Practical Example

Let's combine these statements into a simple JCL job that runs a program and uses an input data set.

Example:

//MYJOB   JOB (12345), 'Sample Job', CLASS=A, MSGCLASS=X
//STEP1   EXEC PGM=IEFBR14
//SYSIN   DD  *
This is input data
/*

Explanation:

  1. The JOB statement defines the job with name MYJOB.
  2. The EXEC statement specifies that the program IEFBR14 should be executed.
  3. The DD statement SYSIN provides in-stream input data to the program.

Summary

In this section, we covered the three primary JCL statements:

  • JOB Statement: Defines the job and provides job-level parameters.
  • EXEC Statement: Specifies the program or procedure to be executed.
  • DD Statement: Describes the data sets used in the job.

Understanding these statements is essential for writing effective JCL scripts. In the next section, we will dive deeper into each of these statements, starting with the JOB statement.

© Copyright 2024. All rights reserved