Pass JCL symbol to in-stream data sets

user823959 picture user823959 · Aug 9, 2011 · Viewed 22.9k times · Source

I'm trying to create and delete a dataset with a JCL symbol in the dataset name this way:

//    SET DATE=20110809
//* DELETE DATASET
//DEL01 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
           DELETE DATASET.TEMP.&DATE                PURGE
           SET MAXCC = 0
//* CREATE DATASET
//STEP01   EXEC PGM=IEFBR14
//DELDD    DD DSN=DATASET.TEMP.&DATE,
//            DISP=(NEW,CATLG,DELETE)

The problem is that I can not use a JCL symbol within a instream (SYSIN DD *). I can't be sure if the dataset already exists so I can not just use DISP=(MOD,DELETE,DELETE). Is there another way to delete the data set?

Answer

Ben Cox picture Ben Cox · Oct 11, 2013

As of z/OS 2.1 (released 30 September 2013), using symbols in JES2 in-stream data is possible by adding the SYMBOLS keyword to the DD statement. Possible values are:

  • SYMBOLS=JCLONLY: Replaces JCL symbols and JES symbols in the in-stream data.

  • SYMBOLS=EXECSYS: Replaces JCL symbols, JES symbols, and system symbols defined on the system during job execution.

  • SYMBOLS=CNVTSYS: Replaces JCL symbols, JES symbols, and system symbols defined on the system during JCL conversion.

The symbols must have been exported.

An example is as follows, from [2]:

// EXPORT SYMLIST=(DSN,VOL)
// SET DSN='ABC.DATA',VOL='123456'
//STEP1 EXEC PGM=USERPGM1
//DATA     DD DSN=&DSN,DISP=SHR
//SYSIN    DD *,SYMBOLS=EXECSYS
  SYSTEM=&SYSNAME,DSNAME=&DSN,VOLUME=&VOL
  FUNCTION='&APPL_NAME'
/*

For more information, including the syntax for configuring where the symbol substitution log goes, see: