Page 1 of 1

Parameters in JCL

PostPosted: Mon Feb 14, 2011 9:28 pm
by LotharLochkarte
Hi,

I have the following JCL:
// SET FILENAME=MYUSER.TEST.DATASET
//*                           
//*                           
//DEL     EXEC PGM=IDCAMS     
//SYSPRINT DD SYSOUT=*       
//SYSIN    DD *               
 DELETE MYUSER.TEST.DATASET


Is there a possibility to use the &FILENAME parameter in the DELETE-statement?

 DELETE &FILENAME

doesn't work...

Thanks!

Re: Parameters in JCL

PostPosted: Mon Feb 14, 2011 9:43 pm
by enrico-sorichetti
we confirm that the way You coded Your thing does not work :D

review the jcl manuals for the use of the SET construct!
here
z/OS V1R6.0-V1R10.0 MVS JCL User's Guide
http://publibz.boulder.ibm.com/cgi-bin/ ... 0712160458
and here
z/OS V1R10.0 MVS JCL Reference
http://publibz.boulder.ibm.com/cgi-bin/ ... 0604022956

Re: Parameters in JCL

PostPosted: Mon Feb 14, 2011 10:00 pm
by steve-myers
You can't send a JCL defined symbol to a program in the way proposed in the initial post. JCL symbols exist only while the JCL is initially being processed and disappear at execution unless the symbol is sent to the program by using the symbol in JCL. There is a way to accomplish exactly what the original post wants to do.
//         SET FILENAME='XXX.YYY'
//A       EXEC PGM=IKJEFT01,PARM='DEL ''%FILENAME'''
//SYSTSPRT DD  SYSOUT=*
//SYSTSIN  DD  DUMMY

Re: Parameters in JCL

PostPosted: Tue Feb 15, 2011 2:17 am
by LotharLochkarte
Thank you both! :)

Re: Parameters in JCL

PostPosted: Tue Feb 15, 2011 12:30 pm
by mongan
Thanks Steve, did not know you could pass the parameter like that to tso, tricky syntax, neat. By the way, in other forums I am Basler or Warp5, decide to go by real name here.

Re: Parameters in JCL

PostPosted: Wed Feb 16, 2011 4:04 am
by LotharLochkarte
Yes, that is indeed a nice workaround!

By the way, I was quite sure that it is impossible to use normal JCL parameters in these statements, but you never know... Maybe there is an expert outside who knows a tricky solution!? :-)

Fortunately, this has been the case here! :-)

Re: Parameters in JCL

PostPosted: Wed Feb 16, 2011 7:31 am
by steve-myers
LotharLochkarte wrote:... By the way, I was quite sure that it is impossible to use normal JCL parameters in these statements, but you never know...
What do you mean by "normal" JCL parameters? My little sample won't feed back the return code from the DELETE command, though I think there is a way to get it.

Of course there is the time honored -
//         SET FILENAME='XXX.YYY'
//DELETE  EXEC PGM=IEFBR14
//ADS      DD  DISP=(MOD,DELETE),UNIT=SYSALLDA,SPACE=(TRK,0),
//             DSNAME=&FILENAME

Granted it does not set a condition code, too, if that's important for you, and it has other possible problems, like it will fail if the dataset is on tape, but it has worked well for many decades.

Re: Parameters in JCL

PostPosted: Wed Feb 16, 2011 12:47 pm
by LotharLochkarte
steve-myers wrote:
LotharLochkarte wrote:... By the way, I was quite sure that it is impossible to use normal JCL parameters in these statements, but you never know...
What do you mean by "normal" JCL parameters?


What I wanted to say was: I was quite sure that JCL "SET PARAM=xxx" parameters are only to be used in "normal" JCL statements, that means lines beginning with "//".

Are there other types of parameters than these "SET ... " in JCL?

Re: Parameters in JCL

PostPosted: Wed Feb 16, 2011 8:03 pm
by steve-myers
I do believe the first two characters in

//A EXEC PGM=IKJEFT01,PARM='DEL ''%FILENAME'''

are "//". That should make it "normal" JCL.

Re: Parameters in JCL

PostPosted: Mon Feb 21, 2011 4:33 pm
by stevexff
My little sample won't feed back the return code from the DELETE command, though I think there is a way to get it.
There is; use IKJEFT1B instead of IKJEFT01...