Procedure Name

Purpose

A procedure name in JCL is used on the EXEC statement to identify a cataloged or in-stream procedure to be executed. This allows reuse of predefined sequences of JCL statements, reducing redundancy and improving standardization.

Syntax

jcl
1
//stepname EXEC procname[,parameter-overrides]

Format

  • procname: 1-8 character name of a procedure
  • Must be a member name in a procedure library (for cataloged procedures)
  • Or defined in-stream between PROC and PEND statements
  • Cannot be specified with PGM parameter on the same EXEC statement
  • May be followed by parameter overrides for the procedure

Examples

Basic Usage

jcl
1
//STEP1 EXEC PAYROLL

Executes the cataloged procedure named PAYROLL

With Parameter Overrides

jcl
1
2
3
//STEP2 EXEC COBOL, // REGION=4M, // PARM.COB='NOMAP,NOSEQ'

Executes the COBOL procedure with overrides for REGION and the PARM parameter on step COB

With Symbolic Parameter

jcl
1
2
//STEP3 EXEC SORT, // DATE=&SYSDATE

Executes the SORT procedure, passing the current system date to the DATE symbolic parameter

In-stream Procedure Definition and Call

jcl
1
2
3
4
5
//MYPROC PROC //STEP1 EXEC PGM=IEFBR14 //DD1 DD DSN=MY.DATASET,DISP=SHR // PEND //RUNPROC EXEC MYPROC

Defines an in-stream procedure MYPROC and then executes it

Procedure Libraries

Cataloged procedures are typically stored in procedure libraries defined by the installation:

  • SYS1.PROCLIB - Main system procedure library
  • Additional libraries defined in the JES2/JES3 procedure
  • User-defined procedure libraries specified with JCLLIB statement

Parameter Overrides

You can override parameters and DD statements within procedures:

  • EXEC parameter overrides: parameter=value
  • Step-specific parameter overrides: parameter.procstep=value
  • DD statement overrides: //stepname.procstep.ddname DD ...
  • DD statement additions: //stepname.ddname DD ...

Notes

  • You must specify either a procedure name or PGM on each EXEC statement (but not both)
  • Procedure names are case-sensitive and must match the name in the procedure library
  • Procedures can contain multiple steps
  • In-stream procedures are defined between PROC and PEND statements
  • Cataloged procedures are precompiled and stored in a procedure library
  • The JCLLIB statement can be used to specify additional procedure libraries
  • Procedures can contain symbolic parameters for customization
  • Nested procedures are supported (procedures calling other procedures) up to 15 levels deep

Common Mistakes

  • Misspelling procedure names
  • Failing to include necessary JCLLIB statements for custom procedure libraries
  • Using both a procedure name and PGM parameter in the same EXEC statement
  • Incorrect syntax for parameter or DD statement overrides
  • Attempting to override non-existent parameters or DD statements

Related Concepts

Related Pages