开发者

Pass JCL symbol to in-stream data sets

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 th开发者_C百科at 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?


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:

  • [1] The z/OS 2.1 Information Center
  • [2] Slides from SHARE in Boston 2013 (Tom Wasik, IBM), pages 20-24


JCL does not support symbol substitution within inline data as you have found out...

The following should work for you:

//DEL01   EXEC PGM=IEFBR14          
//DELDD    DD DSN=DATASET.TEMP.&DATE, 
//         DISP=(MOD,DELETE,DELETE), 
//         SPACE=(TRK,0)             

Add a SPACE parameter. If the dataset doesn't exist it will be created because of the MOD disposition. Then it will be DELETED upon step completion. Net result is that after this step, the named dataset will not exist.

The only real problem that I see is with:

//    SET DATE=20110809

The date you are giving is 8 characters long (maximum qualifier length) but does not begin with an alphabetic or national character (it begins with a numeric). This will result in an invalid dataset name. The dataset DATE qualifer will become too long if you just add an alpha prefix to it. The common approach to this problem is to use Julian dates as in: 2011221. Prefix the Julian Date with either an alpah or national character as in: D2011221. So your SET directive would become something like:

//    SET DATE=D2011221

And all should work out.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜