Parameters in JCL



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Parameters in JCL

Postby LotharLochkarte » Mon Feb 14, 2011 9:28 pm

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!
LotharLochkarte
 
Posts: 68
Joined: Fri Aug 27, 2010 6:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Parameters in JCL

Postby enrico-sorichetti » Mon Feb 14, 2011 9:43 pm

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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3002
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Parameters in JCL

Postby steve-myers » Mon Feb 14, 2011 10:00 pm

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
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Parameters in JCL

Postby LotharLochkarte » Tue Feb 15, 2011 2:17 am

Thank you both! :)
LotharLochkarte
 
Posts: 68
Joined: Fri Aug 27, 2010 6:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Parameters in JCL

Postby mongan » Tue Feb 15, 2011 12:30 pm

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.
User avatar
mongan
 
Posts: 211
Joined: Tue Jan 11, 2011 8:32 pm
Has thanked: 1 time
Been thanked: 5 times

Re: Parameters in JCL

Postby LotharLochkarte » Wed Feb 16, 2011 4:04 am

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! :-)
LotharLochkarte
 
Posts: 68
Joined: Fri Aug 27, 2010 6:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Parameters in JCL

Postby steve-myers » Wed Feb 16, 2011 7:31 am

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.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Parameters in JCL

Postby LotharLochkarte » Wed Feb 16, 2011 12:47 pm

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?
LotharLochkarte
 
Posts: 68
Joined: Fri Aug 27, 2010 6:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Parameters in JCL

Postby steve-myers » Wed Feb 16, 2011 8:03 pm

I do believe the first two characters in

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

are "//". That should make it "normal" JCL.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Parameters in JCL

Postby stevexff » Mon Feb 21, 2011 4:33 pm

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...
Steve
stevexff
 
Posts: 56
Joined: Wed Nov 10, 2010 7:48 pm
Has thanked: 0 time
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post