MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Check whether a data set exists in a JCL

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
amit4u79
Beginner


Joined: 24 Oct 2005
Posts: 109
Topics: 36
Location: India

PostPosted: Thu Feb 17, 2011 12:17 pm    Post subject: Check whether a data set exists in a JCL Reply with quote

Hi,

Hold on I am not asking a stupid question to tell me how do I check if a data set(PDS) exists before I go ahead and delete it. The issue is I am using a couple of SET= parameter in my JCL to get the data set names from the JCL submitter and then want to use any of IDCAMS or IEFBR14 or anything that checks the existence of the data set. The issue is these utilities take the data set name in SYSIN parameter and that is where my issue is. For example:
Code:

//COMPRULE JOB (ZFX76P,REFR),SCANJCL,CLASS=X,MSGCLASS=Y,NOTIFY=&SYSUID
// SET DAT1=REXX
// SET DAT2=REXX1
// SET DAT3=REXX2
// SET LOCDSN1=TZ5T24.TEST
// SET LOCDSN2=TZ5T24.TEST
// SET LOCDSN3=TZ5T24.TEST
//STEP1 EXEC PGM=IEFBR14
//FILEIN DD DSN=&LOCDSN2..&DAT2,DISP=(OLD,CATLG)
//


will give me a JCL error and doesnt go to the next step. Similarly for use of IDCAMS:
Code:

//COMPRULE JOB (ZFX76P,REFR),SCANJCL,CLASS=X,MSGCLASS=Y,NOTIFY=&SYSUID
// SET DAT1=REXX
// SET DAT2=REXX1
// SET DAT3=REXX2
// SET LOCDSN1=TZ5T24.TEST
// SET LOCDSN2=TZ5T24.TEST
// SET LOCDSN3=TZ5T24.TEST
//STEP1 EXEC PGM=IDCAMS
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
LISTCAT 'dsname'
/*


Also, doesnt work since I have to provide the exact name of the data set in quotes and there is no way to substitute the input dsname into the SYSIN since it doesnt take the Override statement.

Hope the info helps you understand my issue and be able to equip you to help me with the solution.

Thanks for any help.
_________________
I did not fail; I have found 10,000 ways that would not work - Albert Einstein.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu Feb 17, 2011 12:28 pm    Post subject: Reply with quote

amit4u79,

Do you want to delete the entire pds or just the non existent member? If you want to delete the entire pds then it is quite easy with a dummy IEFBR14 step.

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Thu Feb 17, 2011 12:37 pm    Post subject: Reply with quote

Removed the post as kolusu has already replied and my response was not entirely correct.
_________________
Regards,
Diba
Back to top
View user's profile Send private message Send e-mail
amit4u79
Beginner


Joined: 24 Oct 2005
Posts: 109
Topics: 36
Location: India

PostPosted: Fri Feb 18, 2011 12:57 am    Post subject: Reply with quote

Hello Kolusu/Dibakar, I want to delete the entire PDS, but with IEFBR14 if I give a DISP in the DD statement it will JCL ERROR out the next time the JCL runs in case the PDS doesnt exist. That is the reason wanted to know how do I code a JCL which (a) takes the data set name from the user in terms of those SET variable statements (b) Deletes them (c) doesnt JCL error out even if the data set is not existing while deleting them. Hope this explaination helps you to understand what I wanted to achieve.

Kolusu, what do you mean by a DUMMY IEFBR14, a DISP=(,DELETE) ? Doesnt it give a JCL error for next run of the JCL ? I wanted to continue processing to next steps of the JCL even if the data set didn't exist and the previous step(the IEFBR14 or IDCAMS) gave me some condition code(dont want to JCL error out of the JOB).
_________________
I did not fail; I have found 10,000 ways that would not work - Albert Einstein.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Feb 18, 2011 1:52 am    Post subject: Reply with quote

if you would have spent some time with the manuals,
instead of pontificating:

Code:

//*
//DELETE01 EXEC PGM=IEFBR14,REGION=4096K
//OUTDD    DD  DSN=BRENHOD.SEARCH.TEST,
//             SPACE=(TRK,(1,1),RLSE),
//             DISP=(MOD,DELETE,DELETE)
//*


will never cause a problem if the dsn BRENHOD.SEARCH.TEST is not there.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
amit4u79
Beginner


Joined: 24 Oct 2005
Posts: 109
Topics: 36
Location: India

PostPosted: Fri Feb 18, 2011 3:59 am    Post subject: Reply with quote

hey Dick, thanks for the help mate.
_________________
I did not fail; I have found 10,000 ways that would not work - Albert Einstein.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
tcurrier
Intermediate


Joined: 10 Feb 2006
Posts: 188
Topics: 68

PostPosted: Tue Sep 20, 2011 6:30 pm    Post subject: Reply with quote

"I did not fail; I have found 10,000 ways that would not work - Albert Einstein."

Amit4u79 - this quote is normally attributed to Thomas Edison, not Albert Einstein Very Happy
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Wed Sep 21, 2011 4:41 pm    Post subject: Reply with quote

tcurrier wrote:
"I did not fail; I have found 10,000 ways that would not work - Albert Einstein."

Amit4u79 - this quote is normally attributed to Thomas Edison, not Albert Einstein Very Happy


Ok. make that 10,001 Smile
_________________
New members are encouraged to read the How To Ask Questions The Smart Way FAQ at http://www.catb.org/~esr/faqs/smart-questions.html.
Back to top
View user's profile Send private message Visit poster's website
Anuj Dhawan
Intermediate


Joined: 19 Jul 2007
Posts: 298
Topics: 7
Location: Mumbai,India

PostPosted: Thu Sep 22, 2011 8:14 am    Post subject: Reply with quote

Good one, semigeezer. Nice sentiment... . Smile
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group