How to run a step upon the existence of a dataset?



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

How to run a step upon the existence of a dataset?

Postby ksatyana1 » Fri Dec 14, 2007 9:08 pm

Hi
I would like to execute a step if a dataset exist, else don’t execute. I am tried with the following code, its not working. I know this is wrong since JCL first checks for the existence of datasets before it tires to run. Is there any way I can approach?
My JCL below
//KOTA01 EXEC PGM=IDCAMS
//SYSUDUMP DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
LISTCAT ENTRIES('KOTASA.VAA.ISTHIS.EXIST')
IF LASTCC = 4 THEN DO
SET MAXCC = 1
END IF
/*
//IFKOTA01 IF (KOTA01.RC = 0) THEN
//KOTA02 EXEC PGM=FILEAID,REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSLIST DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//DD01 DD DSN=KOTASA.VAA.ISTHIS.EXIST,
// DISP=SHR
//DD01O DD DSN=KOTASA.VAA.ISTHIS.EXIST1,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(TRK,(1,1),RLSE),
// DCB=(LRECL=80,BLKSIZE=0,RECFM=FB)
//SYSIN DD *
$$DD01 COPYALL IF=(11,EQ,C'...H'),R=(289,C' ')
/*
//IFKOTA01 ENDIF
//*

Kota
ksatyana1
 
Posts: 7
Joined: Wed Nov 14, 2007 10:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to run a step upon the existence of a dataset?

 

Re: How to run a step upon the existence of a dataset?

Postby MrSpock » Fri Dec 14, 2007 9:32 pm

I don't understand. Your post the way you've coded it works just fine. What problem are you seeing?
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

Re: How to run a step upon the existence of a dataset?

Postby ksatyana1 » Fri Dec 14, 2007 9:37 pm

When I run, I am getting the error as follows,
LOCATE FOR STEP=KOTA02 DD=DD01 DSN=KOTASA.VAA.ISTHIS.EXIST
DATASET NOT FOUND ON MAIN PROCESSOR SY2
ksatyana1
 
Posts: 7
Joined: Wed Nov 14, 2007 10:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to run a step upon the existence of a dataset?

Postby dick scherrer » Sat Dec 15, 2007 12:52 am

Hello,

If you post the IDCAMS output and JES system outputs, we may be better able to help.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: How to run a step upon the existence of a dataset?

Postby ksatyana1 » Sat Dec 15, 2007 2:36 am

IAT6140 JOB ORIGIN FROM GROUP=ANYLOCAL, DSP=IR , DEVICE=INTRDR , 0000
10:12:46 ---- IAT6853 THE CURRENT DATE IS FRIDAY, 14 DEC 2007 ----
NCS0318 IATUX28 VALIDATED PROJECT NUMBER
IRR010I USERID KOTASA IS ASSIGNED TO THIS JOB.
10:12:46 NCS0301 7/348 END OF INPUT SERVICE PROCESSING C=A U=KOTASA
10:12:46 IAT4401 LOCATE FOR STEP=KOTA01 DD=JOBLIB DSN=VAA.T770141.CHGMAN.U
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPDS
10:12:46 IAT4401 LOCATE FOR STEP=KOTA01 DD=JOBLIB DSN=VAA.T770141.CHGMAN.U
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPDS
10:12:46 IAT4401 LOCATE FOR STEP=KOTA01 DD=JOBLIB DSN=VAA.P770141.CHGMAN.U
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPDS
10:12:46 IAT4401 LOCATE FOR STEP=KOTA01 DD=JOBLIB DSN=MSS.DIVISION.USERLIB
10:12:46 IAT4402 UNIT=3390 ,VOL(S)=USRLIB
10:12:46 IAT4401 LOCATE FOR STEP=KOTA01 DD=JOBLIB DSN=ASMT.P958150.CHGMAN.
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPVT
10:12:46 IAT4401 LOCATE FOR STEP=KOTA02 DD=JOBLIB DSN=VAA.T770141.CHGMAN.U
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPDS
10:12:46 IAT4401 LOCATE FOR STEP=KOTA02 DD=JOBLIB DSN=VAA.T770141.CHGMAN.U
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPDS
10:12:46 IAT4401 LOCATE FOR STEP=KOTA02 DD=JOBLIB DSN=VAA.P770141.CHGMAN.U
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPDS
10:12:46 IAT4401 LOCATE FOR STEP=KOTA02 DD=JOBLIB DSN=MSS.DIVISION.USERLIB
10:12:46 IAT4402 UNIT=3390 ,VOL(S)=USRLIB
10:12:46 IAT4401 LOCATE FOR STEP=KOTA02 DD=JOBLIB DSN=ASMT.P958150.CHGMAN.
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPVT
10:12:46 IAT4401 LOCATE FOR STEP=KOTA02 DD=DD01 DSN=KOTASA.VAA.ISTHIS.EX
10:12:46 IAT4404 DATASET NOT FOUND ON MAIN PROCESSOR SY2
10:12:46 IAT4401 LOCATE FOR STEP=STEP01 DD=JOBLIB DSN=VAA.T770141.CHGMAN.U
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPDS
10:12:46 IAT4401 LOCATE FOR STEP=STEP01 DD=JOBLIB DSN=VAA.T770141.CHGMAN.U
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPDS
10:12:46 IAT4401 LOCATE FOR STEP=STEP01 DD=JOBLIB DSN=VAA.P770141.CHGMAN.U
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPDS
10:12:46 IAT4401 LOCATE FOR STEP=STEP01 DD=JOBLIB DSN=MSS.DIVISION.USERLIB
10:12:46 IAT4402 UNIT=3390 ,VOL(S)=USRLIB
10:12:46 IAT4401 LOCATE FOR STEP=STEP01 DD=JOBLIB DSN=ASMT.P958150.CHGMAN.
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPVT
10:12:46 IAT4401 LOCATE FOR STEP=STEP02 DD=JOBLIB DSN=VAA.T770141.CHGMAN.U
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPDS
10:12:46 IAT4401 LOCATE FOR STEP=STEP02 DD=JOBLIB DSN=VAA.T770141.CHGMAN.U
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPDS
10:12:46 IAT4401 LOCATE FOR STEP=STEP02 DD=JOBLIB DSN=VAA.P770141.CHGMAN.U
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPDS
10:12:46 IAT4401 LOCATE FOR STEP=STEP02 DD=JOBLIB DSN=MSS.DIVISION.USERLIB
10:12:46 IAT4402 UNIT=3390 ,VOL(S)=USRLIB
10:12:46 IAT4401 LOCATE FOR STEP=STEP02 DD=JOBLIB DSN=ASMT.P958150.CHGMAN.
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPVT
10:12:46 IAT4401 LOCATE FOR STEP=STEP03 DD=JOBLIB DSN=VAA.T770141.CHGMAN.U
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPDS
10:12:46 IAT4401 LOCATE FOR STEP=STEP03 DD=JOBLIB DSN=VAA.T770141.CHGMAN.U
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPDS
10:12:46 IAT4401 LOCATE FOR STEP=STEP03 DD=JOBLIB DSN=VAA.P770141.CHGMAN.U
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPDS
10:12:46 IAT4401 LOCATE FOR STEP=STEP03 DD=JOBLIB DSN=MSS.DIVISION.USERLIB
10:12:46 IAT4402 UNIT=3390 ,VOL(S)=USRLIB
10:12:46 IAT4401 LOCATE FOR STEP=STEP03 DD=JOBLIB DSN=ASMT.P958150.CHGMAN.
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPVT
10:12:46 IAT4401 LOCATE FOR STEP=STEP04 DD=JOBLIB DSN=VAA.T770141.CHGMAN.U
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPDS
10:12:46 IAT4401 LOCATE FOR STEP=STEP04 DD=JOBLIB DSN=VAA.T770141.CHGMAN.U
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPDS
10:12:46 IAT4401 LOCATE FOR STEP=STEP04 DD=JOBLIB DSN=VAA.P770141.CHGMAN.U
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPDS
10:12:46 IAT4401 LOCATE FOR STEP=STEP04 DD=JOBLIB DSN=MSS.DIVISION.USERLIB
10:12:46 IAT4402 UNIT=3390 ,VOL(S)=USRLIB
10:12:46 IAT4401 LOCATE FOR STEP=STEP04 DD=JOBLIB DSN=ASMT.P958150.CHGMAN.
10:12:46 IAT4402 STORCLAS=SCSTD, DATACLAS=DCDFLT, MGMTCLAS=MCPVT
10:12:46 IAT6312 THE FOLLOWING 000001 MESSAGES MAY BE LOGGED OUT OF SEQUENCE
10:12:46 ICH70001I KOTASA LAST ACCESS AT 10:12:46 ON FRIDAY, DECEMBER 14, 20
10:12:46 IAT4801 JOB KOTASAXX (JOB97417) EXPRESS CANCELED BY INTERPRETER DSP
//KOTASAXX JOB (770000141,2,P),'C8-KOTASA', *
// MSGCLASS=T,NOTIFY=KOTASA
//*MAIN LINES=(999,W),ORG=LOCAL,CLASS=A
//*
//*===============================================================
//* CHECK FOR FILE EXIST / NOT
//*===============================================================
//JOBLIB DD DSN=VAA.T770141.CHGMAN.USERLIB,DISP=SHR
// DD DSN=VAA.T770141.CHGMAN.USERLIB,DISP=SHR
// DD DSN=VAA.P770141.CHGMAN.USERLIB,DISP=SHR
// DD DSN=MSS.DIVISION.USERLIB,DISP=SHR
// DD DSN=ASMT.P958150.CHGMAN.USERLIB,DISP=SHR
//*
//KOTA01 EXEC PGM=IDCAMS
//SYSUDUMP DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
/*
//IFKOTA01 IF (KOTA01.RC = 0) THEN
//KOTA02 EXEC PGM=FILEAID,REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSLIST DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//DD01 DD DSN=KOTASA.VAA.ISTHIS.EXIST,
// DISP=SHR
//DD01O DD DSN=KOTASA.VAA.ISTHIS.EXIST1,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(TRK,(1,1),RLSE),
// DCB=(LRECL=80,BLKSIZE=0,RECFM=FB)
//SYSIN DD *
/*
//IFKOTA01 ENDIF
//*
//STEP01 EXEC PGM=IDCAMS
//SYSUDUMP DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
/*
//*
//IFEXIST1 IF (STEP01.RC = 0) THEN
//STEP02 EXEC PGM=IDCAMS
//SYSUDUMP DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
/*
//*
//IFEXIST2 IF (STEP02.RC = 0) THEN
//STEP03 EXEC PGM=IDCAMS
//SYSUDUMP DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
/*
//IFEXIST2 ELSE
//STEP04 EXEC PGM=IDCAMS
//SYSUDUMP DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
/*
//IFEXIST2 ENDIF
//IFEXIST1 ENDIF
//*
1 //KOTASAXX JOB (770000141,2,P),'C8-KOTASA',
// MSGCLASS=T,NOTIFY=KOTASA
//*MAIN LINES=(999,W),ORG=LOCAL,CLASS=A
//*
//*===============================================================
//* CHECK FOR FILE EXIST / NOT
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+---->
//*===============================================================
2 //JOBLIB DD DSN=VAA.T770141.CHGMAN.USERLIB,DISP=SHR
3 // DD DSN=VAA.T770141.CHGMAN.USERLIB,DISP=SHR
4 // DD DSN=VAA.P770141.CHGMAN.USERLIB,DISP=SHR
5 // DD DSN=MSS.DIVISION.USERLIB,DISP=SHR
6 // DD DSN=ASMT.P958150.CHGMAN.USERLIB,DISP=SHR
//*
7 //KOTA01 EXEC PGM=IDCAMS
8 //SYSUDUMP DD SYSOUT=*
9 //SYSOUT DD SYSOUT=*
10 //SYSPRINT DD SYSOUT=*
11 //SYSIN DD *
12 //IFKOTA01 IF (KOTA01.RC = 0) THEN
13 //KOTA02 EXEC PGM=FILEAID,REGION=6M
14 //SYSPRINT DD SYSOUT=*
15 //SYSLIST DD SYSOUT=*
16 //SYSTOTAL DD SYSOUT=*
17 //DD01 DD DSN=KOTASA.VAA.ISTHIS.EXIST,
// DISP=SHR
18 //DD01O DD DSN=KOTASA.VAA.ISTHIS.EXIST1,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(TRK,(1,1),RLSE),
// DCB=(LRECL=80,BLKSIZE=0,RECFM=FB)
19 //SYSIN DD *
20 //IFKOTA01 ENDIF
//*
21 //STEP01 EXEC PGM=IDCAMS
22 //SYSUDUMP DD SYSOUT=*
23 //SYSOUT DD SYSOUT=*
24 //SYSPRINT DD SYSOUT=*
25 //SYSIN DD *
//*
26 //IFEXIST1 IF (STEP01.RC = 0) THEN
27 //STEP02 EXEC PGM=IDCAMS
28 //SYSUDUMP DD SYSOUT=*
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+---->
29 //SYSOUT DD SYSOUT=*
30 //SYSPRINT DD SYSOUT=*
31 //SYSIN DD *
//*
32 //IFEXIST2 IF (STEP02.RC = 0) THEN
33 //STEP03 EXEC PGM=IDCAMS
34 //SYSUDUMP DD SYSOUT=*
35 //SYSOUT DD SYSOUT=*
36 //SYSPRINT DD SYSOUT=*
37 //SYSIN DD *
38 //IFEXIST2 ELSE
39 //STEP04 EXEC PGM=IDCAMS
40 //SYSUDUMP DD SYSOUT=*
41 //SYSOUT DD SYSOUT=*
42 //SYSPRINT DD SYSOUT=*
43 //SYSIN DD *
44 //IFEXIST2 ENDIF
45 //IFEXIST1 ENDIF
//*
******************************** Bottom of Data ********************************
ksatyana1
 
Posts: 7
Joined: Wed Nov 14, 2007 10:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to run a step upon the existence of a dataset?

Postby MrSpock » Sat Dec 15, 2007 2:51 am

I did a lookup on the IAT4401 message, and found out that:

1. It's a JES3 message. Might've been nice to know that detail up front.

2. It's only informational.
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

Re: How to run a step upon the existence of a dataset?

Postby dick scherrer » Sun Dec 16, 2007 8:09 am

Hello,

Thanks for postng the JES system output.

Please also post the output from the IDCAMS steps.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: How to run a step upon the existence of a dataset?

Postby ksatyana1 » Mon Dec 17, 2007 8:27 pm

This is what I see entire spool...Please help
ksatyana1
 
Posts: 7
Joined: Wed Nov 14, 2007 10:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to run a step upon the existence of a dataset?

Postby dick scherrer » Mon Dec 17, 2007 11:06 pm

Hello,

Looking at the jcl you posted, there should be some more "output" datasets (from the idcams/fileaid steps). They would be sysout, sysprint, syslist, etc (they will be defined as sysout=* in the jcl). These outputs will show what processing and/or problems resulted when the step executed.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: How to run a step upon the existence of a dataset?

Postby ksatyana1 » Tue Dec 18, 2007 2:25 am

Hi
Its giving during syntax check it self. If I put select infront of job I see only the following,
Jobs Resources Devices Tools Filter View Options Help
DSSTAT KOTASAXX JOB97417 196 Records Row 1 of 2
Command ===> Scroll ===> CSR
Cmd DDName StepName ProcName Que* C Pri Cpy Hld Destination Records
JESMSGLG HLD T 2 1 LOCAL 70
JESJCL HLD T 2 1 LOCAL 126
******************************* Bottom of Data ********************************

So you can understand that I was not given any SYSOUT for the steps.

Thanks
Kota
ksatyana1
 
Posts: 7
Joined: Wed Nov 14, 2007 10:33 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post