# INCLUDE statement - IBM-JCL

1.Syntax

The INCLUDE statement consists of the characters // in columns 1 and 2 and four fields: name, operation (INCLUDE), keyword parameter (MEMBER), and

2.Name Field
A name is optional on an INCLUDE statement. If used, code it as follows:

• The name should be unique within the job.
• The name must begin in column 3.
• The name is 1 through 8 alphanumeric or national ($, #, @) characters. • The first character must be alphabetic or national ($, #, @).
• The name must be followed by at least one blank.
• The name may be preceded by up to 8 alphanumeric or national characters, and then separated by a period. Coding the name in this way should not be confused with specifying an override, as can be done when coding DD statements.

If you do not code a name, column 3 must be blank.

3.Operation Field
The operation field consists of the characters INCLUDE and must be preceded and followed by at least one blank. It can begin in any column.

4.Parameter Field
The INCLUDE statement contains one keyword parameter:

MEMBER=name
Specifies the name of a member of a PDS or partitioned data set extended (PDSE) that contains the set of JCL statements (called an INCLUDE group) to be imbedded in the JCL stream.

The PDS or PDSE must be one of the following:

• A system procedure library (such as SYS1.PROCLIB), or
• An installation-defined procedure library, or
• A private library that you must specify on a JCLLIB statement appearing earlier in the job.

The comments field follows the parameter field after at least one intervening blank.

6.Location in the JCL
An INCLUDE statement:

• Can appear anywhere in the job after the JOB statement, with one exception: if there is a JCLLIB statement, the INCLUDE statement must follow the JCLLIB statement.
• Must follow a complete JCL statement.
• Can appear within an INCLUDE group. INCLUDE groups can contain INCLUDE statements and can be nested up to a maximum of 15 levels of nesting.
• Cannot appear in a CNTL/ENDCNTL group, which contains program control statements delimited by the CNTL and ENDCNTL statements.

7.Considerations for Using INCLUDE Groups
System and private libraries can contain both procedures and INCLUDE groups. The order in which the system searches system and private libraries for INCLUDE groups is the same as the search order used for procedures.

INCLUDE groups cannot contain the following JCL statements:

JOB statements PROC and PEND statements JCLLIB statements JES2 and JES3 statements and commands DD * and DD DATA statements

Do not define procedures in an INCLUDE group. However, you can put EXEC statements that invoke procedures in an INCLUDE group.

You can use INCLUDE statements to imbed INCLUDE groups that contain DD and OUTPUT JCL statements, which allows you to use the same data set definitions for various jobs.

When the INCLUDE statement and the INCLUDE group contain symbolic
parameters, the system substitutes the values that are current at the time the symbolic parameter is encountered. Values assigned to symbolic parameters in an INCLUDE group (such as with the SET statement) are valid for use on subsequent JCL statements.

8.Examples of the INCLUDE Statement:

Example

The following INCLUDE group is defined in member SYSOUT2 of private library CAMPBELL.SYSOUT.JCL.

The system executes the following program:

The 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:

The system imbeds the INCLUDE group in the JCL stream (replacing the INCLUDE statement), and processes the included JCL statements with the JCL stream.

Example

The following example shows the use of the SET statement to assign values to symbolic parameters in an INCLUDE group.

The following program is executed.

The 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:

The 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.