Previous Topic: GENMAP Utility - List Field VariablesNext Topic: REPEAT Statement


INCLUDE Statement

JCL templates can contain %%INCLUDE statements. The INCLUDE statement points to the name of a sequential data set or to the data set and member name of a PDS. When a template that contains an INCLUDE statement is opened, it is automatically expanded and the contents of the designated file included in the parent template. INCLUDE statements can be recursive.

The syntax of the INCLUDE statement is:

%%INCLUDE DSNAME datasetname MEMBER membername

The keyword DSNAME can be abbreviated as DSN, MEMBER can be abbreviated as MEM.

Also, the blank delimiters can be replaced by a comma (,) or an equal sign (=). Any number of consecutive delimiters is allowed. The above statement could also be written as:

%%INCLUDE DSN=datasetname, MEM = membername

The DSN can be up to 44 characters long, the member name up to 8 characters.

Note: If DSN is omitted, the system assumes that the included file resides in the same library as the parent template. Therefore, when using a single library for JCL templates, there is no need to specify the DSN.

INCLUDE statements are intended for the reuse of existing templates in the creation of new ones. They provide a convenient way to create standard building blocks for JCL streams. For example, INCLUDE statements allow for job card customization in a standard storage management job template.

Member JCARD in DSN=CA.VANT.JCLLIB can contain your customized version of the following:

//JOBNAME   JOB  (ACCT-INFO),'YOUR-NAME',CLASS=C,MSGCLASS=X, 
//          NOTIFY=&SYSUID               

Member JDEFRAG in DSN=CA.VANT.JCLLIB can then contain:

%%INCLUDE DSN=CA.VANT.JCLLIB,MEMBER=JCARD                        
//***************************************************************
//*** JCL TEMPLATE FOR DEFRAG OF A VOLUME                      **
//***************************************************************
//DEFRAG   EXEC PGM=ADRDSSU                                      
//SYSPRINT DD SYSOUT=*                                           
//SYSIN    DD *                                                  
 DEFRAG  DYNAM(%%VOL%%)                                          
/*  

If an error occurs during the expansion of an INCLUDE statement (for example, a referenced member is not found), processing stops and an error message appears instead of the expanded statement.