View previous topic :: View next topic |
Author |
Message |
amit4u79 Beginner
Joined: 24 Oct 2005 Posts: 109 Topics: 36 Location: India
|
Posted: Thu Feb 17, 2011 12:17 pm Post subject: Check whether a data set exists in a JCL |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Thu Feb 17, 2011 12:28 pm Post subject: |
|
|
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 |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 700 Topics: 63 Location: USA
|
Posted: Thu Feb 17, 2011 12:37 pm Post subject: |
|
|
Removed the post as kolusu has already replied and my response was not entirely correct. _________________ Regards,
Diba |
|
Back to top |
|
|
amit4u79 Beginner
Joined: 24 Oct 2005 Posts: 109 Topics: 36 Location: India
|
Posted: Fri Feb 18, 2011 12:57 am Post subject: |
|
|
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 |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Fri Feb 18, 2011 1:52 am Post subject: |
|
|
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 |
|
|
amit4u79 Beginner
Joined: 24 Oct 2005 Posts: 109 Topics: 36 Location: India
|
Posted: Fri Feb 18, 2011 3:59 am Post subject: |
|
|
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 |
|
|
tcurrier Intermediate
Joined: 10 Feb 2006 Posts: 188 Topics: 68
|
Posted: Tue Sep 20, 2011 6:30 pm Post subject: |
|
|
"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 |
|
Back to top |
|
|
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Wed Sep 21, 2011 4:41 pm Post subject: |
|
|
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 |
Ok. make that 10,001 _________________ 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 |
|
|
Anuj Dhawan Intermediate
Joined: 19 Jul 2007 Posts: 298 Topics: 7 Location: Mumbai,India
|
Posted: Thu Sep 22, 2011 8:14 am Post subject: |
|
|
Good one, semigeezer. Nice sentiment... . _________________ Regards,
Anuj |
|
Back to top |
|
|
|
|