View previous topic :: View next topic
|
Author |
Message |
vikramyadav
New User
Joined: 28 May 2005 Posts: 41 Location: Gurgaon
|
|
|
|
Suppose i have a job step JS010 & JS020. Now i want to place a job step after JS010 which will check the return code of JS010 & the job will abend if RC=0012. HOw can this be done? I checked the forum but couldnt find anything |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
The answer is in the JCL Manual. See the IF/THEN/ELSE/ENDIF construct. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
why do you need to abend the job ?
If you really need to abend a job, you can run a program such as SAS to generate an abend code or execute a program that does not exist, this will return an 806 abend code.
Gerry |
|
Back to top |
|
|
vikramyadav
New User
Joined: 28 May 2005 Posts: 41 Location: Gurgaon
|
|
|
|
What i want is that the job should abend if JS010.RC=12 else it should proceed with the execution of the next step. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Why do you want an abend - there is already an rc=12 that can be used to conditionally not execute the next step.
Most organizations do not want unnecessary abends. Conditional execution is usually preferred.
If only an abend will do, change the module that issues the rc=12 and have it abend instead. |
|
Back to top |
|
|
vikramyadav
New User
Joined: 28 May 2005 Posts: 41 Location: Gurgaon
|
|
|
|
Actually, what happens is that we get an RC=12 in some steps but still the job goes on to execute the next step and it might have a RC=0.
So if we have 4 steps.
JS010
JS020
JS030
JS040
I want to put a condition after JS020 that the job should abend if JS020.RC=12. Similarly i want to put a condition after JS030 that the job should abend if JS030.RC=12. Because otheriwse suppose i get a RC=12 in JS020 then still the job will go ahead and execute the rest of the steps.
I am thinking something like the below.
Code: |
//JS010 EXEC.....
//JS020 EXEC......
//JS021 IF (JS020.RC = 12) THEN
ABEND HERE
//ELSE
CONTINUE
//JS030 EXEC.......
//JS031 IF (JS020.RC = 12) THEN
ABEND HERE
//ELSE
CONTINUE
//JS040 EXEC.......
//
|
|
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
There are many topics in these forums that explain how to code a COBOL program to abend by using a call to ILBOABN0. |
|
Back to top |
|
|
vikramyadav
New User
Joined: 28 May 2005 Posts: 41 Location: Gurgaon
|
|
|
|
I am not looking for a COBOL program here. I just want something in my existing JCL |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
the only reason steps continue to process is because you have incorrectly tested the return codes or the lack of testing.
Gerry |
|
Back to top |
|
|
vikramyadav
New User
Joined: 28 May 2005 Posts: 41 Location: Gurgaon
|
|
|
|
I think the system is setup this way......please can someone give some solution as to how this is to be done |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
what happens is that we get an RC=12 in some steps but still the job goes on to execute the next step |
Quote: |
I want to put a condition after JS020 that the job should abend if JS020.RC=12. Similarly i want to put a condition after JS030 that the job should abend if JS030.RC=12. Because otheriwse suppose i get a RC=12 in JS020 then still the job will go ahead and execute the rest of the steps. |
If you properly check the rc, you will be able to prevent this. . .
Quote: |
please can someone give some solution as to how this is to be done |
code COND=(12,EQ) the EXEC for JS020, JS030, and JS040.
At the top of the page is a link to "IBM Manuals" whick includes the JCL Reference. There are examples of cond= in the manual. If you find something that is not clear, post what you found and your queston about it. Someone will be able to clarify. |
|
Back to top |
|
|
vikramyadav
New User
Joined: 28 May 2005 Posts: 41 Location: Gurgaon
|
|
|
|
Code: |
JS010 ** R0000 **
JS020 ** R0000 **
JS030 ** R0012 **
JS035 ** R0012 **
JS040 ** R0000 **
JS050 ** R0000 **
JS060 ** R0000 **
|
I have the above information of the return codes from the actual job. PS030 & PS035 are FTP steps & the RC of an FTP step is set to 12 if there is an any issue while FTPing, as can be seen that still the continuing jobsteps still ran. So restating that i just want the job to abend after JS030 if the JS030.RC=12 similarly for JS035. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
it helps if you explain what you are trying to do, so are you saying your issue arises only when restarting the job ?
If you only want to run the one step, then just code this on your jobcard
Code: |
// RESTART=JS030.XXXX,COND=(0,EQ)
|
Gerry |
|
Back to top |
|
|
vikramyadav
New User
Joined: 28 May 2005 Posts: 41 Location: Gurgaon
|
|
|
|
No you got it wrong.
Actually the job is having steps JS030 & JS035 which are the FTP steps. Now FTP steps are such that if there is an issue while FTP'ing a dataset then the return code is set to 12 but the job goes on to execute the next steps & does not abend. I infact want the job to abend if it finds a RC=12 at JS030 & JS035.
I hope there is no confusion now. Thanks |
|
Back to top |
|
|
km_abdullah
New User
Joined: 03 Nov 2008 Posts: 60
|
|
|
|
Vikram,
You have probably not tried what d.sch. has suggested. The answer is there with the COND parameter which you need to code for each step from JS020. Have you tried that solution?
Probably your meaning for 'abend' is that you want remaining jobsteps to be 'flushed' in case a step returns RC12. Is this correct? |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
my apologies, I read your restating as restarting (time for glasses).
Are you not concerned if JS010 & JS020 return a cond greater than 0 ?
Gerry |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Vikram,
As repeatedly suggested in the above thread, it IS possible to prevent the execution of subsequent steps by the proper usage of the COND parameter. |
|
Back to top |
|
|
vikramyadav
New User
Joined: 28 May 2005 Posts: 41 Location: Gurgaon
|
|
|
|
Hi gcicchet
I am only concerned with the RC of JS030 & JS035 as only these are the FTP steps. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Why not try out the solution already posted here by Dick? |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
I was looking for a simpler solution, ie. if you code
on the jobcard, as soon as a step has a RC greater than 0, subsequent steps will flush.
Gerry |
|
Back to top |
|
|
vikramyadav
New User
Joined: 28 May 2005 Posts: 41 Location: Gurgaon
|
|
|
|
//JS010 EXEC PGM=IEBGENER
//JS020 EXEC PGM=IEBGENER
//JS030 EXEC for FTP
//JS035 EXEC for FTP
//JS040 EXEC PGM=IEBGENER
//JS050 EXEC PGM=SORT
//JS060 EXEC PGM=SORT
The job steps are as above. The rest(all except JS)030 & JS035) of the steps will just perform normally i.e. abend if a RC=12 is issued but the FTP steps will just set the RC to 12 incase of an unsuccessful FTP but will not abend, so in effect the continuing steps will also execute. So i need to add an additional step after JS030 that will check for JS030.RC=12 & abend if it is true, so that the continuing steps will not execute. Similarly for JS035. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
I think you are missing the point, abending a STEP is not the only way to flush subsequent steps,
Quote: |
As repeatedly suggested in the above thread, it IS possible to prevent the execution of subsequent steps by the proper usage of the COND parameter |
Please test some of the suggestions
Gerry |
|
Back to top |
|
|
km_abdullah
New User
Joined: 03 Nov 2008 Posts: 60
|
|
|
|
It seems that you are stressing only your point but not paying heed to the suggestion provided in the tread. Are you not able to understand that the solution is already given to you but you have not tried?
Quote: |
, so in effect the continuing steps will also execute. |
Only to avoid this, COND solution is provided.
Quote: |
So i need to add an additional step after JS030 that will check for JS030.RC=12 |
It is better that you read the JCL manual about the COND parameter. You don’t need a additional step to do this. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
You continue to add on to the jobstream. . . But this should not natter - if you set up the jcl correctly.
By proper checking of return-codes you can run all, some, or no more steps depending on the setting of the rc by some previous step(s).
If you set up your jcl similar to the way i posted earlier, you should be able to handle your requirement rather straightforward. Suggest you start with 2 or 3 steps and show yourself how adding the COND= to the executes accomplishes what you want. As you become more familiar with this, it will go very quickly.
If something seems troubling, post what has happened and someoneo will be able to help. |
|
Back to top |
|
|
vikramyadav
New User
Joined: 28 May 2005 Posts: 41 Location: Gurgaon
|
|
|
|
For JS010 & JS020 i dont want to handle anything.
For JS030 & JS035 i want to abend if these issue RC=12 and as you say "flush" the rest of the steps if it abends. |
|
Back to top |
|
|
|