Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass JCL symbol to in-stream data sets

Tags:

mainframe

jcl

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?

like image 848
user823959 Avatar asked Aug 09 '11 15:08

user823959


People also ask

How do you pass a symbolic parameter in Sysin JCL?

Symbolic parameters can be set to values in the JCL with the SET statement or through PROC symbolic parameter processing. Exported symbolic parameter values can also be passed into in-stream (sysin) data; see Using symbols in JES2 in-stream data for details.

What does the symbol indicates in JCL?

z/OS MVS JCL Reference System symbols and JCL symbols are character strings that represent variable information in JCL. They allow you to modify JCL statements in a job easily. A symbol-defining string is limited to eight characters, not including the identifying ampersand (&) character.

What is the DD statement to indicate data in the input stream?

A step can contain more than one in-stream data set. Use the DD DATA statement when the data contains JCL statements. Code the DSNAME parameter on the DD * or DATA statement to assign the last qualifier of the system-generated name to an in-stream data set.

What is instream data in JCL?

An in-stream data set is a data set contained within a set of JCL statements. In-stream data sets (also called inline data sets) begin with a DD * or DD DATA statement. These DD statements can have any valid ddname, including SYSIN .


2 Answers

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
like image 82
Ben Cox Avatar answered Sep 28 '22 14:09

Ben Cox


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.

like image 33
NealB Avatar answered Sep 28 '22 14:09

NealB