Skip to main content

Introduction

In large-scale batch processing systems, Job Control Language (JCL) is used to manage the execution of programs on IBM mainframes. To avoid writing repetitive code and to make JCL more modular, procedures (PROCs) are used reducing redundancy and improving maintainability.

JCL supports two types of procedures: in-stream procedures, defined within the job itself, and cataloged procedures, stored externally in system libraries. These procedures can include steps, DD statements, and symbolic parameters that make them flexible and customizable at runtime.

By using procedures, organizations can standardize batch operations, ensure consistency across environments, and make JCL easier to read and manage. They also support conditional execution, parameter substitution, and DD overrides for dynamic control. Overall, procedures are a key feature in modularizing and managing batch workflows efficiently on IBM mainframe systems.

Feel free to refer to setup for testing some scenarios. Make sure to replace <Your ID> with your training ID and <YOUR REXX EXEC> with the REXX EXEC dataset created.


Exercise - Practice instructions

Follow these steps to implement and test your knowledge of JCL procedures.

Q. Create and Test an In-stream Procedure

  • Write a JCL that defines an in-stream procedure named MYPROC.
  • Include a step in the procedure that executes program IEBGENER or a dummy like IEFBR14.
  • Call that procedure

Q. Create and use Cataloged Procedure

  • Create a member called CATPROC (e.g., MY.PROCLIB) and define a two-step cataloged procedure in it.
  • Submit a job that uses this proc and test its execution.
  • Use the same PROC in two different jobs with different parameter values.
  • Observe the outputs to confirm procedural reusability.

Exercise: Create JCL for both In-stream and catalog procedure

Q. Override a DD Statement in the Procedure

  1. In the calling JCL, override one of the DD statements (e.g., change input or output dataset).
  2. In your calling JCL, simulate removal of a dataset used inside the PROC.
  3. In the calling JCL, add a DD named SYSPRINT to the PROC step from outside.
  4. The PROC step uses an input dataset with DISP=SHR. Override it in the calling JCL to create a new dataset instead.
  5. The PROC uses a single input dataset. In the calling JCL, override it with two concatenated datasets.
  6. In the PROC, the output dataset is a physical dataset. Override it in the JCL to send it to destination A.

Q. Use Symbolic Parameters

Pre-requiste

  • DS1 has a default value.
  • DS2 is not defined in the PROC header, so it must be explicitly provided using EXEC or SET.
//MYPROC   PROC DS1=INPUT.DEFAULT
//STEP1 EXEC PGM=IEFBR14
//IN1 DD DSN=&DS1,DISP=SHR
//OUT1 DD DSN=&DS2,DISP=SHR

Now execute and answer the below questions.

  • Call MYPROC without overriding any parameters. What happens?

  • Override both symbolic parameters in the EXEC. What values are used?

  • Use SET statements to define values for DS1 and DS2, and don't override them in EXEC. What values are used?

  • Use both SET DS2=SET.VALUE and EXEC DS2=EXEC.VALUE. Which value is used?

  • Use SET DS2=SET.VALUE, and don't override it in EXEC. What value is used?
  • Use neither SET nor EXEC for DS2. What happens?

  • Override only DS2 in the EXEC. What values are used?

  • Set DS1 via SET and DS2 via EXEC. What values are used?

Q. Use COND Inside the PROC

  • Add a step inside your PROC to be skipped if any previous step RC is GT 4.
  • In the calling JCL, override a PROC step's condition is GT 5.
  • Add a step in the PROC that deliberately ABEND.
  • Use COND in the next step to execute only if previous step ABEND.
  • Use COND in the next step to execute irrespective of previous step failure.

Q. Use REFERBACK

  • Inside your cataloged PROC, use attributes(like DSN) from a any DD within or previous step.
  • Use the DCB attributes from previous step and override BLKSIZE.