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: 1249 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: 1703 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
Site Director
Joined: 23 Nov 2006 Posts: 19254 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
Moderator Team Head
Joined: 26 Apr 2004 Posts: 4650 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: 1703 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
Site Director
Joined: 23 Nov 2006 Posts: 19254 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: 1703 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: 1703 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: 1703 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 |
|
 |
|