Previous Topic

Next Topic

Book Contents

Book Index

Examples for SET VAR

SET VAR Example 1

In this example, AutoEdit statements in the job scheduling definition and the JCL allocate space for the job. If the job abends due to insufficient space, the AutoEdit statements adjust the allocated space and rerun or restart the job.

The following step in the JCL of the job sets the quantity of available space to five units of whatever type (track or cylinder) is specified in the job scheduling definition.

//STEP10 EXEC PGM=MYPGM

//OUTFILE  DD DSN=NEWFILE,DISP=(NEW,CATLG,DELETE),

//                 SPACE=(%%SPACE_TYPE,5),UNIT=SYSDA

The job scheduling definition contains the following SET VAR statement that sets the space type to "track":

SET VAR  %%SPACE_TYPE=TRK

In this case, the second line in the above DD statement resolves to:

//               SPACE=(TRK,5),UNIT=SYSDA

The job scheduling definition also contains the following statements that are activated if the job abends due of lack of space (code S*37). These statements change the space type to "cylinder", which provides enough space, and rerun the job. If Control-M/Restart is active, the job is restarted from the abended step.

ON PGMST STEP10  CODES S*37

DO SET  %%SPACE_TYPE = CYL

[DO IFRERUN   FROM $ABEND] ===> If CONTROL-R is active

DO RERUN

If the job abends due to insufficient space, the second line of the earlier JCL DD statement resolves to:

//               SPACE=(CYL,5),UNIT=SYSDA

when the job is submitted for rerun (or restart).

SET VAR Examples 2A and 2B

The following examples show how one job scheduling definition and one JCL member can be used for both the test environment and the production environment by changing the value of only one parameter, the SET VAR parameter.

Assume the following JCL for the job:

//PRDKPL01 JOB 0,M22,CLASS=A,MSGCLASS=X,REGION=4000K

//STEP01  EXEC %%PROC%%.INPT

//STEP02  EXEC %%PROC%%.UPDT  

//STEP03  EXEC %%PROC%%.RPTS

SET VAR Example 2A

The following job scheduling definition replaces the %%PROC variable in the EXEC statements of the JCL with procedure name prefix TEST.

Figure 307 SET VAR Parameter Example – 2A

JOB: PRDKPL01 LIB CTM.PROD.SCHEDULE                             TABLE: PRODKPL

COMMAND ===>                                                    SCROLL===> CRSR

+-----------------------------------------------------------------------------+

  MEMNAME PRDKPL01    MEMLIB   CTM.PROD.JCL                                 

  OWNER   SYS1        TASKTYPE JOB    PREVENT-NCT2   DFLT  N                

  APPL    KPL                         GROUP PROD-KPL                        

  DESC    DAILY PRODUCTION - START OF APPL-PROD-KPL                         

  OVERLIB                                                   STAT CAL        

  SCHENV                         SYSTEM ID                  NJE NODE        

  SET VAR %%PROC=TEST                                                

  SET VAR                                                                   

  CTB STEP AT         NAME            TYPE                                  

  DOCMEM  PRDKPL01    DOCLIB   CTM.PROD.DOC                                 

  ===========================================================================

  SCHEDULE RBC                                                              

  RELATIONSHIP (AND/OR)                                                     

  DAYS    01                                                    DCAL        

                                                                     AND/OR

  WDAYS                                                         WCAL        

  MONTHS  1- Y 2- Y 3- Y 4- Y 5- Y 6- Y 7- Y 8- Y 9- Y 10- Y 11- Y 12- Y    

  DATES                                                                     

  CONFCAL          SHIFT       RETRO Y MAXWAIT 00  D-CAT                    

  MINIMUM          PDS                                                      

COMMANDS: EDIT, DOC, PLAN, JOBSTAT                                    18.36.07

When a SET VAR statement is used to specify %%PROC=TEST, the JCL is resolved as follows:

//PRDKPL01 JOB 0,M22,CLASS=A,MSGCLASS=X,REGION=4000K

//STEP01  EXEC TESTINPT

//STEP02  EXEC TESTUPDT

//STEP03  EXEC TESTRPTS

SET VAR Example 2B

The job scheduling definition has now been modified to replace the procedures (%%PROC) used in the job with production (PROD) procedures.

Figure 308 SET VAR Parameter Example 2B

JOB: PRDKPL01 LIB CTM.PROD.SCHEDULE                            TABLE: PRODKPL

COMMAND ===>                                                   SCROLL===> CRSR

+----------------------------------------------------------------------------+

  MEMNAME PRDKPL01    MEMLIB   CTM.PROD.JCL                                 

  OWNER   SYS1        TASKTYPE JOB    PREVENT-NCT2   DFLT  N                

  APPL    KPL                         GROUP PROD-KPL                        

  DESC    DAILY PRODUCTION - START OF APPL-PROD-KPL                         

  OVERLIB                                                   STAT CAL        

  SCHENV                         SYSTEM ID                  NJE NODE        

  SET VAR %%PROC=PROD                                                 

  SET VAR                                                                   

  CTB STEP AT         NAME            TYPE                                  

  DOCMEM  PRDKPL01    DOCLIB   CTM.PROD.DOC                                 

  ===========================================================================

  SCHEDULE RBC                                                              

  RELATIONSHIP (AND/OR)                                                     

  DAYS    01                                                    DCAL        

                                                                     AND/OR

  WDAYS                                                         WCAL        

  MONTHS  1- Y 2- Y 3- Y 4- Y 5- Y 6- Y 7- Y 8- Y 9- Y 10- Y 11- Y 12- Y    

  DATES                                                                     

  CONFCAL          SHIFT       RETRO Y MAXWAIT 00  D-CAT                    

  MINIMUM          PDS                                                      

  DEFINITION ACTIVE FROM          UNTIL                                    

  ===========================================================================

COMMANDS: EDIT, DOC, PLAN, JOBSTAT                                   18.36.07

When a SET VAR statement is used to specify %%PROC=PROD, the JCL is resolved as following:

//PRDKPL01 JOB 0,M22,CLASS=A,MSGCLASS=X,REGION=4000K

//STEP01  EXEC PRODINPT

//STEP02  EXEC PRODUPDT

//STEP03  EXEC PRODRPTS

Parent Topic

SET VAR: General Job Parameter