In JCL, there are two different procedures. One is Cataloged, and the other one is in-stream. JCL procedures, like any other language, are routines. We can reuse them any no of times so that we can avoid errors.
Proc in JCL
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.
- Procedure statements processed first before executing the job
- JCL statements in a procedure are processed by Reader/Interpreter of JES
- WE CAN NOT CALL PROCEDURE FROM A PROCEDURE
- PROC statement can be coded in cataloged procedure, but it is not required.
JCL Proc Types
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)
Temporary procedures (a.k.a in-stream procedure)
- It always be coded after JOB statement, and before EXEC statement
- We can have maximum of 15 in stream procedures
- 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:
- Like cataloged procedures, INCLUDE groups are stored in PDS libraries.
- 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.
- INCLUDE statements can be nested up to 15 levels deep
- 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.
Related Posts