View previous topic :: View next topic |
Author |
Message |
Milind Beginner
Joined: 29 Dec 2004 Posts: 26 Topics: 20
|
Posted: Tue Jun 14, 2005 4:13 am Post subject: How to know the existence of a file thru a JCL |
|
|
Hi All,
I have a query regarding dataset existence:
How can I know whether a dataset exists or not in a JCL? Based on this I will decide my DISP parameter. Either new or old.
Thanks in advance.
Milind Deshmukh. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
|
Posted: Tue Jun 14, 2005 5:23 am Post subject: |
|
|
Milind,
You can use IDCAMS REPRO to figure out if the dataset exists and if exists if it was empty or not by using the following JCL
Code: |
//*********************************
//* RC=0 - DATASET HAS RECS **
//* RC=4 - DATASET EMPTY **
//* RC=12 - DATASET NOT FOUND **
//*********************************
//STEP0100 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
PRINT IDS(YOUR.DATA.SET) CHARACTER COUNT(1)
/*
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
Milind Beginner
Joined: 29 Dec 2004 Posts: 26 Topics: 20
|
Posted: Tue Jun 14, 2005 5:37 am Post subject: |
|
|
THANKS KOLUSU.
Cheers,
Milind Deshmukh. |
|
Back to top |
|
 |
nevilh Beginner
Joined: 11 Aug 2004 Posts: 115 Topics: 0
|
Posted: Tue Jun 14, 2005 5:48 am Post subject: |
|
|
If you have already submitted the job how will you change the disposition
the decision has already been made |
|
Back to top |
|
 |
Bill Dennis Advanced

Joined: 03 Dec 2002 Posts: 579 Topics: 1 Location: Iowa, USA
|
Posted: Tue Jun 14, 2005 10:12 am Post subject: |
|
|
Your JCL would have multiple execution paths (NEW or OLD) based on the CCODE from the IDCAMS step. See the IF,THEN logic for JCL. _________________ Regards,
Bill Dennis
Disclaimer: My comments on this foorum are my own and do not represent the opinions or suggestions of any other person or business entity. |
|
Back to top |
|
 |
nevilh Beginner
Joined: 11 Aug 2004 Posts: 115 Topics: 0
|
Posted: Tue Jun 14, 2005 10:17 am Post subject: |
|
|
Fine for Jes2 . Jes3 will give you an error |
|
Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Tue Jun 14, 2005 3:23 pm Post subject: |
|
|
Why not just have an IEFBR14 step that uses DISP=MOD (which will allocate the file if it does not exist, and do nothing if it does), then use DISP=OLD in the subsequent step(s). That is how this is normally done, as far as I know. |
|
Back to top |
|
 |
|
|