In this section, we will explore the JCLLIB and INCLUDE statements, which are essential for managing and organizing JCL procedures and libraries. These statements help in modularizing JCL code, making it more maintainable and reusable.
JCLLIB Statement
Purpose
The JCLLIB statement is used to specify the libraries that contain the procedures and INCLUDE members referenced in a JCL job. It helps the system locate the necessary procedures and INCLUDE members.
Syntax
Parameters
ORDER
: Specifies the order in which the system should search the libraries for the procedures and INCLUDE members.
Example
In this example, the system will first search PROCLIB1
and then PROCLIB2
for the required procedures and INCLUDE members.
Practical Example
In this example, the JCLLIB
statement specifies MY.PROCLIB
as the library to search for the procedure MYPROC
.
INCLUDE Statement
Purpose
The INCLUDE statement is used to include a member from a library into the JCL stream. This allows for modularization and reuse of common JCL code segments.
Syntax
Parameters
MEMBER
: Specifies the name of the member to be included.
Example
In this example, the system will include the member COMMONSETUP
from the libraries specified in the JCLLIB
statement.
Practical Example
//JCLLIB ORDER=(MY.INCLUDELIB) //MYJOB JOB (ACCT),'MY JOB',CLASS=A,MSGCLASS=X //INCLUDE MEMBER=COMMONSETUP //STEP1 EXEC PGM=MYPROG
In this example, the INCLUDE
statement includes the member COMMONSETUP
from MY.INCLUDELIB
before executing the program MYPROG
.
Combining JCLLIB and INCLUDE Statements
Example
//JCLLIB ORDER=(MY.PROCLIB, MY.INCLUDELIB) //MYJOB JOB (ACCT),'MY JOB',CLASS=A,MSGCLASS=X //INCLUDE MEMBER=COMMONSETUP //STEP1 EXEC MYPROC
In this example:
- The
JCLLIB
statement specifies two libraries:MY.PROCLIB
andMY.INCLUDELIB
. - The
INCLUDE
statement includes the memberCOMMONSETUP
from the specified libraries. - The
STEP1
executes the procedureMYPROC
found inMY.PROCLIB
.
Practical Exercise
Exercise
- Create a JCL job that uses the
JCLLIB
statement to specify a library. - Use the
INCLUDE
statement to include a common setup member. - Execute a procedure from the specified library.
Solution
//JCLLIB ORDER=(MY.PROCLIB, MY.INCLUDELIB) //MYJOB JOB (ACCT),'MY JOB',CLASS=A,MSGCLASS=X //INCLUDE MEMBER=COMMONSETUP //STEP1 EXEC MYPROC
Explanation
- The
JCLLIB
statement specifiesMY.PROCLIB
andMY.INCLUDELIB
as the libraries to search. - The
INCLUDE
statement includes the memberCOMMONSETUP
from the specified libraries. - The
STEP1
executes the procedureMYPROC
found inMY.PROCLIB
.
Common Mistakes and Tips
Common Mistakes
- Incorrect Library Order: Ensure the libraries are specified in the correct order in the
JCLLIB
statement. - Missing Member: Verify that the member specified in the
INCLUDE
statement exists in the specified libraries.
Tips
- Modularize Code: Use
INCLUDE
statements to modularize common JCL code segments, making your JCL jobs more maintainable. - Library Management: Keep your libraries organized and well-documented to avoid confusion and errors.
Conclusion
In this section, we covered the JCLLIB
and INCLUDE
statements, which are crucial for managing and organizing JCL procedures and libraries. By understanding and utilizing these statements, you can create more modular, maintainable, and reusable JCL code. In the next section, we will delve into Generation Data Groups (GDGs), another advanced JCL concept.
JCL (Job Control Language) Course
Module 1: Introduction to JCL
Module 2: JCL Statements and Syntax
Module 3: Data Definition (DD) Statements
Module 4: Procedures and Symbolic Parameters
Module 5: Advanced JCL Concepts
- Conditional Processing
- JCLLIB and INCLUDE Statements
- Generation Data Groups (GDGs)
- Restart and Checkpoint
Module 6: Error Handling and Debugging
- Common JCL Errors
- Interpreting JCL Error Messages
- Debugging Techniques
- Using JES2/JES3 for Troubleshooting