Examples of the INCLUDE statement:
The following examples show INCLUDE statement usage:
- The following INCLUDE group is defined in member SYSOUT2 of private library CAMPBELL.SYSOUT.JCL.
//* THIS INCLUDE GROUP IS CATALOGED AS... //* CAMPBELL.SYSOUT.JCL(SYSOUT2) //SYSOUT2 DD SYSOUT=A //OUT1 OUTPUT DEST=POK,COPIES=3 //OUT2 OUTPUT DEST=KINGSTON,COPIES=30 //OUT3 OUTPUT DEST=MCL,COPIES=10 //* END OF INCLUDE GROUP... //* CAMPBELL.SYSOUT.JCL(SYSOUT2)
The following JCL is executed
: //TESTJOB JOB ... //LIBSRCH JCLLIB ORDER=CAMPBELL.SYSOUT.JCL //STEP1 EXEC PGM=OUTRTN //OUTPUT1 INCLUDE MEMBER=SYSOUT2 //STEP2 EXEC PGM=IEFBR14The JCLLIB statement specifies that the system is to search private library CAMPBELL.SYSOUT.JCL for the INCLUDE group SYSOUT2 before it searches any system libraries.
After the system processes the INCLUDE statement, the JCL stream appears as://TESTJOB JOB ... //LIBSRCH JCLLIB ORDER=CAMPBELL.SYSOUT.JCL //STEP1 EXEC PGM=OUTRTN //* THIS INCLUDE GROUP IS CATALOGED AS... //* CAMPBELL.SYSOUT.JCL(SYSOUT2) //SYSOUT2 DD SYSOUT=A //OUT1 OUTPUT DEST=POK,COPIES=3 //OUT2 OUTPUT DEST=KINGSTON,COPIES=30 //OUT3 OUTPUT DEST=MCL,COPIES=10 //* END OF INCLUDE GROUP... //* CAMPBELL.SYSOUT.JCL(SYSOUT2) //STEP2 EXEC PGM=IEFBR14The system imbeds the INCLUDE group in the JCL stream (replacing the INCLUDE statement), and processes the included JCL statements with the JCL stream.
- The following example shows the use of the SET statement to assign values to symbolic parameters
in an INCLUDE group.
//* THIS INCLUDE GROUP IS CATALOGED AS... //* LAMAN.SYSOUT.JCL(SYSOUT2) //SYSOUT2 DD SYSOUT=A //OUT1 OUTPUT DEST=POK,COPIES=3 //OUT2 OUTPUT DEST=&AA,COPIES=&NC //OUT3 OUTPUT DEST=&BB,COPIES=10 //* END OF INCLUDE GROUP... //* LAMAN.SYSOUT.JCL(SYSOUT2)
The following JCL is executed
:
//JOBA JOB ... //LIBS JCLLIB ORDER=LAMAN.SYSOUT.JCL //SET1 SET AA=KINGSTON,BB=STL,NC=10 //STEP1 EXEC PGM=OUTRTN //OUTPUT1 INCLUDE MEMBER=SYSOUT2 //STEP2 EXEC PGM=IEFBR14The SET statement, which is easy to change for different jobs, assigns values to the symbolic parameters in INCLUDE group SYSOUT2.
After the system processes the INCLUDE statement, it executes the JCL stream as://JOBA JOB ... //LIBS JCLLIB ORDER=LAMAN.SYSOUT.JCL //STEP1 EXEC PGM=OUTRTN //* THIS INCLUDE GROUP IS CATALOGED AS... //* LAMAN.SYSOUT.JCL(SYSOUT2) //SYSOUT2 DD SYSOUT=A //OUT1 OUTPUT DEST=POK,COPIES=3 //OUT2 OUTPUT DEST=KINGSTON,COPIES=10 //OUT3 OUTPUT DEST=STL,COPIES=10 //* END OF INCLUDE GROUP... //* LAMAN.SYSOUT.JCL(SYSOUT2) //STEP2 EXEC PGM=IEFBR14The system imbeds the INCLUDE group in the JCL stream (replacing the INCLUDE statement), and assigns the values to the symbolic parameters in the INCLUDE group.
In this example, INCLUDE member HELLO contains the
following statements://S1 EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSUT2 DD SYSOUT=* //SYSIN DD DUMMY //SYSUT1 DD DATA HELLO /*The following JCL is executed:
//JOBA JOB… //SYSL INCLUDE MEMBER=HELLOAfter the system processes the INCLUDE statement, it executes the JCL stream as:
//JOBA JOB… //S1 EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSUT2 DD SYSOUT=* //SYSIN DD DUMMY //SYSUT1 DD DATA HELLO /*