Passing Variables Using DGADGSUB

You can use the DGADGSUB program, which substitutes variables in the parameter list and then calls the DGADTSUB program to process the parameter list further.

Note: DGADGSUB is not intended to concatenate variables, only to substitute them. Variable concatenation is handled by the parser at PROCESS submit time. DGADGSUB is intended to pass variables to JCL to be substituted into the job.

To do this, modify an existing RUN TASK statement that calls DGADTSUB to call DGADGSUB, and add the variables you want to use in the parameter list.

The following figure is an example of RUN TASK using the DGADGSUB program.

STEP01 RUN TASK(PGM=DGADGSUB -
        PARM=('DSN=DALLAS1.ZOS.SRCLIB(JCLTEST1),DISP=SHR', -
              'JOB &JOBNAME', -
              'SRC %SRCDSN', -
              'DST     %DSTDSN   ', -
              'PROCNAME  %PROCNAME', -
              'PROCNUM %PROCNUM  ', -
              'DSN  DSNNAME')) PNODE

In this example, the following circumstances are in effect:

  • The ‘FROM' data set in the last COPY step before this RUN TASK is DALLAS1.FILE
  • The ‘TO' data set in the last COPY step before this RUN TASK is DALLAS1.TEST.GDG.G0006V00
  • The name of the Process is 'TESTPR'
  • The Process number is 29
  • The &JOBNAME is XYZ

The DGADGSUB program makes the variable substitutions and calls the DGADTSUB program with the following parameters:

PARM=('DSN=DALLAS1.ZOS.SRCLIB(JCLTEST1),DISP=SHR', -
              'JOB XYZ', -
              'SRC DALLAS1.FILE', -
              'DST     DALLAS1.TEST.GDG.G0006V00   ', -
              'PROCNAME  TESTPR', -
              'PROCNUM 00029  ', -
              'DSN  DSNNAME'))

Wherever &JOB, &SRC, &DST, &PROCNAME, &PROCNUM, and &DSN are found in DALLAS1.ZOS.SRCLIB(JCLTEST1), the corresponding values are substituted. Once all the substitutions have been made, the resultant JCL is submitted to JES.