IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Job should abend if a step returns RC=0012


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vikramyadav

New User


Joined: 28 May 2005
Posts: 41
Location: Gurgaon

PostPosted: Wed Feb 04, 2009 7:43 am
Reply with quote

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
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Wed Feb 04, 2009 7:53 am
Reply with quote

The answer is in the JCL Manual. See the IF/THEN/ELSE/ENDIF construct.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Feb 04, 2009 7:56 am
Reply with quote

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
View user's profile Send private message
vikramyadav

New User


Joined: 28 May 2005
Posts: 41
Location: Gurgaon

PostPosted: Wed Feb 04, 2009 8:02 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Feb 04, 2009 8:25 am
Reply with quote

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
View user's profile Send private message
vikramyadav

New User


Joined: 28 May 2005
Posts: 41
Location: Gurgaon

PostPosted: Wed Feb 04, 2009 9:08 am
Reply with quote

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
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4651
Location: Raleigh, NC, USA

PostPosted: Wed Feb 04, 2009 9:18 am
Reply with quote

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
View user's profile Send private message
vikramyadav

New User


Joined: 28 May 2005
Posts: 41
Location: Gurgaon

PostPosted: Wed Feb 04, 2009 9:21 am
Reply with quote

I am not looking for a COBOL program here. I just want something in my existing JCL
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Feb 04, 2009 9:21 am
Reply with quote

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
View user's profile Send private message
vikramyadav

New User


Joined: 28 May 2005
Posts: 41
Location: Gurgaon

PostPosted: Wed Feb 04, 2009 9:33 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Feb 04, 2009 9:48 am
Reply with quote

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
View user's profile Send private message
vikramyadav

New User


Joined: 28 May 2005
Posts: 41
Location: Gurgaon

PostPosted: Wed Feb 04, 2009 10:24 am
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Feb 04, 2009 10:40 am
Reply with quote

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
View user's profile Send private message
vikramyadav

New User


Joined: 28 May 2005
Posts: 41
Location: Gurgaon

PostPosted: Wed Feb 04, 2009 10:44 am
Reply with quote

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
View user's profile Send private message
km_abdullah

New User


Joined: 03 Nov 2008
Posts: 60

PostPosted: Wed Feb 04, 2009 10:47 am
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Feb 04, 2009 10:54 am
Reply with quote

Hi,

my apologies, I read your restating as restarting (time for glasses). icon_redface.gif

Are you not concerned if JS010 & JS020 return a cond greater than 0 ?


Gerry
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Feb 04, 2009 10:57 am
Reply with quote

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
View user's profile Send private message
vikramyadav

New User


Joined: 28 May 2005
Posts: 41
Location: Gurgaon

PostPosted: Wed Feb 04, 2009 11:01 am
Reply with quote

Hi gcicchet

I am only concerned with the RC of JS030 & JS035 as only these are the FTP steps.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Feb 04, 2009 11:05 am
Reply with quote

Why not try out the solution already posted here by Dick?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Feb 04, 2009 11:07 am
Reply with quote

Hi,

I was looking for a simpler solution, ie. if you code
Code:
//   COND=(0,LT)
on the jobcard, as soon as a step has a RC greater than 0, subsequent steps will flush.


Gerry
Back to top
View user's profile Send private message
vikramyadav

New User


Joined: 28 May 2005
Posts: 41
Location: Gurgaon

PostPosted: Wed Feb 04, 2009 11:10 am
Reply with quote

//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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Feb 04, 2009 11:24 am
Reply with quote

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
View user's profile Send private message
km_abdullah

New User


Joined: 03 Nov 2008
Posts: 60

PostPosted: Wed Feb 04, 2009 11:28 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Feb 04, 2009 11:28 am
Reply with quote

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
View user's profile Send private message
vikramyadav

New User


Joined: 28 May 2005
Posts: 41
Location: Gurgaon

PostPosted: Wed Feb 04, 2009 11:31 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts WER999A - UNSUCCESSFUL SORT 8ED U Ab... SYNCSORT 5
No new posts Evaluate variable to execute a jcl step JCL & VSAM 3
No new posts the system or user abend SF0F R=NULL COBOL Programming 0
No new posts Need to get an DLI abend like U0200 IMS DB/DC 2
No new posts pass data as symbolic parameter from ... CLIST & REXX 2
Search our Forums:

Back to Top