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

//JCLLIB ORDER=(library1,library2,...)

Parameters

  • ORDER: Specifies the order in which the system should search the libraries for the procedures and INCLUDE members.

Example

//JCLLIB ORDER=(PROCLIB1, PROCLIB2)

In this example, the system will first search PROCLIB1 and then PROCLIB2 for the required procedures and INCLUDE members.

Practical Example

//JCLLIB ORDER=(MY.PROCLIB)
//MYJOB    JOB  (ACCT),'MY JOB',CLASS=A,MSGCLASS=X
//STEP1    EXEC MYPROC

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

//INCLUDE MEMBER=membername

Parameters

  • MEMBER: Specifies the name of the member to be included.

Example

//INCLUDE MEMBER=COMMONSETUP

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:

  1. The JCLLIB statement specifies two libraries: MY.PROCLIB and MY.INCLUDELIB.
  2. The INCLUDE statement includes the member COMMONSETUP from the specified libraries.
  3. The STEP1 executes the procedure MYPROC found in MY.PROCLIB.

Practical Exercise

Exercise

  1. Create a JCL job that uses the JCLLIB statement to specify a library.
  2. Use the INCLUDE statement to include a common setup member.
  3. 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

  1. The JCLLIB statement specifies MY.PROCLIB and MY.INCLUDELIB as the libraries to search.
  2. The INCLUDE statement includes the member COMMONSETUP from the specified libraries.
  3. The STEP1 executes the procedure MYPROC found in MY.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.

© Copyright 2024. All rights reserved