View previous topic :: View next topic
|
Author |
Message |
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Hi All,
I've 3 steps in my JCL.
STEP1- check file EMPTY or NOT.
STEP2- process only if file not EMPTY.
STEP3- PROGPROC.
Now the prob is if file is Empty, STEP2 will get skipped, but Return Code by STEP1 (which will be greater than zero) will cause STEP3 (PROGPROC) to abend.
Now what can be the way by which I can run STEP2 based on STEP1 and have a MAXCC=0 in STEP3.
Regards,
Priyesh. |
|
Back to top |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
Why you must have 0 as Return code? You cannot work with a 1? |
|
Back to top |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
Sorry... It's impossible reset the rc of a job... you can only reset the rc(last and max) of internal function of IDCAMS if you are referring to it as sample. |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Hi MGIndaco,
Quote: |
Why you must have 0 as Return code? You cannot work with a 1? |
I need to have an RC=0 before coming to STEP3, as its a PROGPROC step which dont allow any thing greater from earlier steps.
My requirement is to simply run STEP2 if a given file is not EMPTY. and then some where later I have a PROGPROC step to be executed.
Now If by any means I m checking for Empty FIle, Its giving a higher RC incase Empty FIle, which consequently creating problem for PROGPROC.
Is there any way, I can get maxcc=0, If file is empty & maxcc=other if not empty.
Or any other solution to this prob from ur perspective.
Regards,
Priyesh. |
|
Back to top |
|
|
anuradha
Active User
Joined: 06 Jan 2004 Posts: 247 Location: Hyderabad
|
|
|
|
Hi Priyesh!
Why dont you code the COND parameter even for the step3 which checks the step1's RC. Will that not help you! |
|
Back to top |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
I think that you must change one of the two contition in your jcl.
You can play the Rc of empty test as you want but once a time.
I suppose that if you can't change the jcl you will modify the pgm of second step and play with its file status... |
|
Back to top |
|
|
subhasis_50
Moderator
Joined: 09 Mar 2005 Posts: 363 Location: Earth
|
|
|
|
Hi,
Quote: |
I need to have an RC=0 before coming to STEP3, as its a PROGPROC step which dont allow any thing greater from earlier steps.
|
You need return code 0 in step3 and you have to run step2 only if the file in step1 is not empty. In case of empty file the step2 is bypassed as u give cond code there. So in that case if u want to run step3 just code a dummy step between step3 and step2. And dont give any cond parameter there. So step3 will not abend though step 2 is bypassed.
Step2....
//*then code the dummy step
//STEPD EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DUMMY
//SYSUT2 DD DUMMY
//step3
Hope it helps. |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Hi All,
Firstly Thanks all of you to put effort.
Quote: |
Hi Priyesh!
Why dont you code the COND parameter even for the step3 which checks the step1's RC. Will that not help you! |
Anu, This won't work......As, befor echecking COND Parm, PROGPROC checks for the RCs by earlier steps.
Quote: |
Step2....
//*then code the dummy step
//STEPD EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DUMMY
//SYSUT2 DD DUMMY
//step3
Hope it helps. |
Subhasis_30, I tried this code too, But it is also not working.
Quote: |
I suppose that if you can't change the jcl you will modify the pgm of second step and play with its file status... |
MGIndaco, This seemes to be the last option. Earlier I was not keen to play with program inside STEP2....Now It doesn't look like any other option.
Once again Thank you all.
Regards,
Priyesh. |
|
Back to top |
|
|
anuradha
Active User
Joined: 06 Jan 2004 Posts: 247 Location: Hyderabad
|
|
|
|
Hi Priyesh!
Can you provide us the JCL. May be after seeing that we can give you the solution. But I still wonder why COND will not solve your purpose. Anyways just give the JCL. |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Hi Anuradha,
Quote: |
Can you provide us the JCL |
Code: |
//STEP1 EXEC PGM=IDCAMS
//IN DD DSN=RECORDS.INPUT,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSIN DD DATA
PRINT INFILE(IN) COUNT(1)
/*
//STEP2 U Can assume any thing, as its going to be skipped.
//*
//STEP3 EXEC PROGPROC,
// GP=TMSDD,
// PGMNAME=PROGRAMNAME
//PRGIN DD DSN=PRG.INPUT,
// DISP=SHR
//RPT01 DD DSN=PRG.OUT,
// DISP=(,CATLG,DELETE),
// SPACE=(6118,(0100,033),RLSE),UNIT=SYSDA
//STATISTR DD SYSOUT=*
//** |
So now, STEP1 will return RC > 0, in case of empty file. & It causes prob in STEP3.
Quote: |
But I still wonder why COND will not solve your purpose. |
I tried with that, but it was not doing.
Regards,
Priyesh. |
|
Back to top |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
Hi Priyesh, another question: the empty file is used in both the pgm? |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Hi MGIndaco,
STEP2 is using that file... Thats why I have to skip STEP2 if file found EMPTY......STEP3 is not using that file.
Regards,
Priyesh. |
|
Back to top |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
Which are the COND parameter that you use? |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
I had given an IF Condition before STEP2 checking for RC of STEP1.
Code: |
//IFSTEP2# IF (STEP1.RC=0)
//*
//STEP2
//*
//ENDSTEP2# ENDIF |
Regards, |
|
Back to top |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
And in the followed PROC which are the condition? |
|
Back to top |
|
|
anuradha
Active User
Joined: 06 Jan 2004 Posts: 247 Location: Hyderabad
|
|
|
|
Hi Priyesh!
I really wonder why COND parameters are not working. Okey let me give them..
Code: |
//PS001 EXEC PGM=IDCAMS
//IN DD DSN=Userid.TEST.IN,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSIN DD DATA
PRINT INFILE(IN) COUNT(1)
/*
//PS002 EXEC PGM=IEFBR14,COND=(0,LT,PS001)
...
...
//PS003 EXEC PGM=IKJEFT01,COND=(8,LT,PS001) |
Just try with the above code.
In the above code if 'Userid.TEST.IN is empty it is going to give RC=4. As 0 is less than 4, step2 will be skipped.. As 8 is not less than 4 step3 will be executed.
Let us know the results.. |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Nothing cond specified for PROC....But as it is a PROGPROC stmt...It will check for all the RCs from earlier steps....& on an empty file STEP1 wont return a zero. which will cause an abend to PROGPROC.
ok, man....Now its time to leave....will c u on Monday....
Regards,
Priyesh. |
|
Back to top |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
I don't think... I don't know what your PROGPROC do but if you use the typrun=scan and see the explosion of the proc you will see if it has a condition parameter. If no condition is specify, but it is you can work with a rc = 1 and go to the end of job.(you can also override the cond in the proc... I think that most rc used begin from 4...)
Good we. |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Hey anuradha,....That worked......STEP3 was executing then....
Thanks a lot for you & MGIndaco for helping me......
The last doubt I have, is when I coded IDCAMS for checking Empty File(It is posted in one of my earlier reply), It was returning an RC=12. But the Same code from You returned 4.
the only difference I could mark in duo is
Code: |
PRINT INFILE(IN) COUNT(1) urs code
PRINT INFILE(IN) COUNT(1) mine |
Is this the cause behind RC=12....& that was leading to a problem in further STEP3.
Thanks again for the effort.
Regards,
Priyesh. |
|
Back to top |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
In IDCAMS utility(and I think for the other utility too) all the command start in position 2
It's a common error but not to bad... |
|
Back to top |
|
|
|