JCL PROC/Procedures

JCL - If Statement JCL Instream Procedure

Advertisements


Procedures are mainly used to define set of frequently executing job control statements and will execute wherever it is needed by using the procedure name.

Procedure provides the user supplied dynamic values to the JCL before running.

The PROC statement tells the beginning of a procedure.

The PROC statement can assign default values to symbolic parameters, if coded.

The procedures in JCL are also called as PROCEDURE.


Syntax - For a cataloged procedure:

[//[name]  PROC [parameter  [comments]]]
//[name]  PROC

Syntax - For an in-stream procedure:

//name  PROC [parameter  [comments]]
//name  PROC

PROC statement can be divided into the below parts.


  • PROCname
  • Operation
  • Parameters
  • Comment

name:


PROCname is required on a PROC statement in an in-stream procedure.

PROCname is optional on a PROC statement in a cataloged procedure.

If PROCname is not coded, column 3 must be blank.

PROCname naming standards:


Rules:

The PROCname must begin in column 3.

The PROCname of 8 characters length which allows alphabets (A-Z), numbers (0-9) and $, #, @ characters.

The first character must be alphabet, $, # and @.

The PROCname must be followed by at least one blank.


Operation:


Operation field describes about the type of operand.

Operation is nothing but PROC.

Operation is of length 4 characters.

Operation can be start at any column.


Parameters:


Parameters assign the default values to the symbolic parameters on the procedure statements.

In-stream PROC statement requires parameters only if the procedure contains symbolic parameters.

If the parameter field is coded, there should be one blank after Operation field.


Comment:


Comment used to make a note of current statement.

Comment field follows parameter field.

Comment field should be preceded with a blank after the parameter field.


Example 1:

//STEP1  EXEC  PROC=MTHPROC,ACCT=5870

The ACCT keyword parameter will be added on every EXEC statement in the procedure if the ACCT parameter is not specified in any of the step in MTHPROC.


Example 2:

//STEP1  EXEC  PROC=MTHPROC,ACCT=5870

The ACCT keyword parameter will override ACCT parameter on every EXEC statement in the procedure if the ACCT parameter is specified in specific the step in MTHPROC.


Example 3:

//STEP2  EXEC  PROC=MTHPROC,ACCT=

The ACCT keyword parameter will nullify the parameter on every EXEC statement in the procedure.


JCL - If Statement JCL Instream Procedure

Advertisements