z/OS MVS JCL Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Examples of the SET statement

z/OS MVS JCL Reference
SA23-1385-00

Example 1: The symbolic parameter DSP is defined and initialized to the value NEW.
   //SET1  SET  DSP=NEW
DSP is referenced by coding &DSP in the JCL, for example:
           .
           .
   //DD1  DD  DSNAME=ALPHA.PGM1,DISP=(&DSP,KEEP)
In the example, &DSP is assigned the value NEW for execution:
   //DD1  DD  DSNAME=ALPHA.PGM1,DISP=(NEW,KEEP)
Example 2: The symbolic parameter DSP is defined and initialized to the value (NEW,DELETE,KEEP).
   //SETA  SET  DSP=(NEW,DELETE,KEEP)
DSP is referenced by coding &DSP in the JCL, for example:
   //PR2  PROC  DSP=(NEW,KEEP)
           .
           .
   //DD6  DD  DSNAME=ALPHA.PGM2,DISP=&DSP
&DSP is assigned the value (NEW,KEEP) from PROC statement PR2 for execution:
   //DD6  DD  DSNAME=ALPHA.PGM2,DISP=(NEW,KEEP)

In the example, the definition of DSP on SET statement SETA does not override the default definition of DSP on PROC statement PR2.

Example 3: This example shows the SET statement spanning two records. The symbolic parameters are defined and initialized to the values shown on SET statement SETB. They are referenced by coding &AA, &BB, and &CC in the JCL, for example:
   //SETB  SET   AA=BETA.PGM.RATE,BB=DCLAS03,
   //         CC=(NEW,KEEP)
            .
            .
   //PR3   PROC  ...
   //S3    EXEC  PGM=...
   //DD7   DD    DSNAME=&AA,DATACLAS=&BB,DISP=&CC
            .
   //      PEND
            .
   //S1    EXEC  PROC=PR3,BB=DCLAS0X
            .
In the example, the values assigned on DD statement DD7 for execution are:
   //DD7  DD  DSNAME=BETA.PGM.RATE,DATACLAS=DCLAS0X,DISP=(NEW,KEEP)

The values defined for the symbolic parameters on SET statement SETB are assigned to the AA and CC symbolic parameters in procedure PR3 for execution. However, the value defined for symbolic parameter BB on EXEC statement S1 overrides the value defined on SET statement SETB.

Example 4: The following example shows the use of the SET statement assigning values to symbolic parameters in an INCLUDE group.
   //*  THIS INCLUDE GROUP IS CATALOGED AS...
   //*  PUCHKOFF.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...
   //*  PUCHKOFF.SYSOUT.JCL(SYSOUT2)
The following program is executed.
   //TESTJOB  JOB  ...
   //LIBSRCH  JCLLIB  ORDER=PUCHKOFF.SYSOUT.JCL
   //SET1     SET     AA=KINGSTON,BB=STL,NC=10
   //STEP1    EXEC    PGM=OUTRTN
   //OUTPUT1  INCLUDE MEMBER=SYSOUT2
   //STEP2    EXEC    PGM=IEFBR14

The SET statement, which can be easily changed for different jobs, assigns values to the symbolic parameters in INCLUDE group SYSOUT2.

After the INCLUDE statement is processed, the JCL stream would be executed as:
   //TESTJOB  JOB  ...
   //LIBSRCH  JCLLIB  ORDER=PUCHKOFF.SYSOUT.JCL
   //STEP1    EXEC    PGM=OUTRTN
   //*  THIS INCLUDE GROUP IS CATALOGED AS...
   //*  PUCHKOFF.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...
   //*  PUCHKOFF.SYSOUT.JCL(SYSOUT2)
   //STEP2    EXEC    PGM=IEFBR14

The INCLUDE group has been imbedded in the JCL stream (replacing the INCLUDE statement) and values assigned to the symbolic parameters in the INCLUDE group.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014