View previous topic :: View next topic |
Author |
Message |
suhas_pm Beginner

Joined: 12 Oct 2004 Posts: 3 Topics: 1 Location: Pune
|
Posted: Tue Oct 12, 2004 5:47 am Post subject: Checking existence of a dataset in JCL at runtime |
|
|
In a JCL, I want to execute a step on the basis of existence of a particular version of a GDG. How to do this?
e.g. consider that I want to execute STEP020 only if dataset NODE1.NODE2.NODE3.NODE4(-14) exists.
//STEP010 EXEC PGM=ABC
//STEP020 EXEC PGM=XYZ <=== execute this if above dataset exists
//STEP030 EXEC PGM=DEF
//*
Could anyone please suggest any way to do this?
regards,
-Suhas |
|
Back to top |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Tue Oct 12, 2004 7:49 am Post subject: |
|
|
You do realize that if the generation in question does not exist then your job will fail with a JCL error?
You might want to re-consider your requirement and run an IDCAMS LISTCAT to generate a list of all generations of the base:
Code: |
//LIST EXEC PGM=IDCAMS
//SYSPRINT DD DSN=&&T1,DISP=(NEW,PASS),...
//SYSIN DD *
LISTCAT LVL(NODE1.NODE2.NODE3.NODE4)
|
And then check the contents of &&T1 and go from there... |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Tue Oct 12, 2004 9:22 am Post subject: |
|
|
Suhas,
If you can spell out the absolute gdg version number instead of the relative number, then you can simply use LISTCAT to figure out if the dataset existed.
Code: |
//STEP0100 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//INGDG DD DSN=YOUR.GDG.TEST(-4),
// DISP=SHR
//SYSIN DD *
LISTCAT ENT('NODE1.NODE2.NODE3.NODE4.G0011V00')
/*
|
The above step will end with a return code of 4.
Now you can check the return code and skip the job.
Code: |
//STEP020 EXEC PGM=XYZ,COND=(4,EQ,STEP0100)
|
The above approach is not possible with relative gdg number ex(NODE1.NODE2.NODE3.NODE4(-14).
So you need to go with superk's solution.
Hope this helps...
Cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
|
|