JCL Instream Procedure

JCL Procedures JCL Catelog Procedure

Advertisements


If a procedure coded in the job called as Instream Procedure.

The coding of in-stream proc will start with PROC and end with PEND.

Coding PROCLIB is not required because the procedure code exists in the inside of same JCL.

Instream procedure can’t be coded within another Instream procedure.

Instream procedure definition executes only when we call the procedures.

PEND is mandatory while coding instream procedure.

Instream procedure allows CNTL, comment, DD, ENDCNTL, EXEC, IF/THEN/ELSE/ENDIF, INCLUDE, OUTPUT JCL, and SET statements only.

Instream procedure will not allow any other statements apart from above.

Instream procedure will not validate for syntax errors until an EXEC statement calls the procedure.

Up to 15 levels of nesting supports in instream procedure.


Syntax:

//PROC
//……
//PEND
	
	OR
	
//name  PROC [parameter  [comments]]
//name  PROC

Defaults and Overrides:


To override a default parameter value on a PROC statement, code the same parameter on the EXEC statement that calls the procedure.

If not coded, the default values coded in PROC statement will get applied.


Example 1:

//STEP01   EXEC PGM=PROG1
//STEPPRC  EXEC PROC=MTHPROC
.
.
.
//MTHPROC
//STEP02   EXEC PGM=PROG2
//STEP03   EXEC PGM=PROG3
//PEND

The above example showing the instream procedure definition and execution within the same job.


Example 2:

//STEP01   EXEC PGM=PROG1
//STEPPRC  EXEC PROC=MTHPROC,TIME=(9,30)
.
.
.
//MTHPROC
//STEP02   EXEC PGM=PROG2
//STEP03   EXEC PGM=PROG3
//PEND

In the above example, the TIME statement adds the time to all the steps of the instream procedure. All the steps in the instream procedure can use the processor for 9 minutes and 30 seconds.


Example 3:

//STEP01   EXEC PGM=PROG1
//STEPPRC  EXEC PROC=MTHPROC,TIME=(9,30)
.
.
.
//MTHPROC
//STEP02   EXEC PGM=PROG2,TIME=(6,30)
//STEP03   EXEC PGM=PROG3
//PEND

In the above example, the TIME statement overrides the TIME values of all the steps in instream procedure. All the steps in the instream procedure can use the processor for 9 minutes and 30 seconds.


Example 3:

//STEP01   EXEC PGM=PROG1
//STEPPRC  EXEC PROC=MTHPROC,TIME=
.
.
.
//MTHPROC
//STEP02   EXEC PGM=PROG2,TIME=(6,30)
//STEP03   EXEC PGM=PROG3
//PEND

In the above example, the TIME statement nullifies the TIME values of all the steps in the instream procedure. TIME parameter values in procedure can be ignored and TIME parameter default value 1440 applied to the entire job.


JCL Procedures JCL Catelog Procedure

Advertisements