JCL Cataloged and In stream Procedures (proc)

In JCL there are two different procedures. One is Cataloged and the other one is in-stream. JCL procedures like any other languages are routines, we can reuse any no of times. So that we can avoid errors.

The below points we can consider as tough JCL interview questions

During execution of JOB we can process it. Sample syntax is :

//step1       exec    proc-name

here, proc-name is cataloged procedures

  1. Procedure statements processed first before executing the job
  2. JCL statements in a procedure are processed by Reader/Interpreter of JES
  3. WE CAN NOT CALL PROCEDURE FROM A PROCEDURE
  4. PROC statement can be coded in cataloged procedure, but it is not required.

Typically there are 4 kinds of procedures:

  • IBM-supplied procedures that compile, link, and run programs

  • JCL steps that back up, delete, and define VSAM files

  • Programs that are required by many jobs

  • Large jobs where it makes sense to separate the steps into manageable procedures (most production jobs fall into this category)

The next one is temporary procedure (a.k.a) in-stream procedure:

  1. It always be coded after JOB statement, and before EXEC statement
  2. We can have maximum of 15 in stream procedures
  3. PROC and END. But name is required for PROC. But, for PEND name is optional

Where do we need to keep cataloged procedures:

//name JCLLIB ORDER=(library[,library]…)

It searches all the libraries first the order you specified, if PROC not found, then, it will search in Prod. If still not found it will search in SYS1.PROCLIB

>>>>USER Libraries ==> PROD Libraries ===> IBM supplied proc library

The most search sequence is 

TEST.PROCLIB  ®  PROD.PROCLIB  ®  SYS1.PROCLIB
The below symbols we can see in JCL Listing

Cataloged procedure

Instream procedure

Meaning

//

//

Statement from input JCL.

XX

++

Statement from procedure.

X/

+/

Procedure statement that you modified.

XX*

++*

Procedure statements, other than comment statements, that were converted to comments (probably because of an error).

***

***

Comments and JES2/JES3 control statements.

INCLUDE Member:

  1. Like cataloged procedures, INCLUDE groups are stored in PDS libraries.
  2. You can use the INCLUDE statement to copy portions of a step, such as a single DD statement or a group of commonly used DD statements.
  3. INCLUDE statements can be nested up to 15 levels deep
  4. We should not code  JOB, PROC, PEND, JCLLIB, DD*, DD DATA in INCLUDE members and JES2,JES3 statements

Sample syntax is:

//SYSOUT DD SYSOUT=*
//          INCLUDE INVMAST
..
..
..
//INVMAST  DD   DSNAME=MMA2.INVENTRY.MASTER,DISP=SHR

Effective JCL is
//INV3010  EXEC PGM=INV3010
//SYSOUT   DD   SYSOUT=*
//INVMAST  DD   DSNAME=MMA2.INVENTRY.MASTER,DISP=SHR
//INVSEL   DD   DSNAME=&&INVSEL,DISP=(NEW,PASS),
//             UNIT=SYSDA,SPACE=(CYL,(20,10))
//SELCTL   DD   DUMMY


The INCLUDE statement is similar to the EXEC statement for a procedure 
in that it lets you copy text directly into your job stream. 

When the job is submitted, the INCLUDE group replaces the INCLUDE statement, and the system processes the embedded text as part of the job stream.
Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.