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

Force a Return Code on a JOB


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

New User


Joined: 13 Dec 2007
Posts: 45
Location: USA

PostPosted: Wed Dec 01, 2010 5:08 am
Reply with quote

Dear Listers,

How can I force a Job to end with a return code (RC) = 06 after I
I detect a string "ABEND" in a dataset? Can this be done via JCL or
a sort. In COBOL, I can use RETURN-CODE to achieve that. I
would like to avoid coding a program from this. Any pointers?

Input:
Code:
****** ***************************** Top of Data *******************
000001 AAA 9293451 88.94  RAYMOND    SACHS     ABEND               
****** **************************** Bottom of Data *****************
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 Dec 01, 2010 9:02 am
Reply with quote

Hello,

Your alternatives will be quite limited if the return code must be 06.

Which sort product is used on your system?
Back to top
View user's profile Send private message
Raymond Sachs

New User


Joined: 13 Dec 2007
Posts: 45
Location: USA

PostPosted: Wed Dec 01, 2010 1:44 pm
Reply with quote

We use SyncSort. I would not mind any other Return code except
for (04, 08, 12). This Return code will help me set conditional
execution in my next step.

So, if STEP030 has a RC= 06, then I would skip STEP040
and continue with STEP050.

On days where there is no presence of the literal "ABEND" in the
dataset, Step030 will get a RC = 0 and continue to process
STEP040 and then Step050.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Dec 01, 2010 1:47 pm
Reply with quote

Hi Dick,

His recent posts suggest that he has Syncsort. And Syncsort can generate RC4 or RC16, but if he's specific about an RC6 sort might not help.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Dec 01, 2010 1:54 pm
Reply with quote

I can not see the relevance of the RC from any step as this can be dealt with using COND= or IF/THEN/ELSE/ENDIF processing.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Dec 01, 2010 4:21 pm
Reply with quote

expat wrote:
I can not see the relevance of the RC from any step as this can be dealt with using COND= or IF/THEN/ELSE/ENDIF processing.

I read him as requiring a return code that is distinct from other likely return codes so that it may be identified as coming from the detection of the string "ABEND". I agree that identifying the step name in the COND parameter or the IF construct ought to handle the situation.

If nothing else but a unique value will do, the TS ought to consult with senpai in his shop; most sites have had for decades little COBOL or assembler programs that take a value as a run-time parameter or in a contol card, and feed it back as a return code or user abend.
Back to top
View user's profile Send private message
Raymond Sachs

New User


Joined: 13 Dec 2007
Posts: 45
Location: USA

PostPosted: Wed Dec 01, 2010 11:01 pm
Reply with quote

Listers,
I am open to any suggestions if we can not use the RC
Quote:
can not see the relevance of the RC from any step as this can be dealt with using COND= or IF/THEN/ELSE/ENDIF processing.


How can I achieve that? I need to look at the literal 'ABEND' in a dataset
which will not be present everyday. So there has to be a mechanism that
will trigger the presence of 'ABEND'.
I can code a COND=(XX,EQ,STEP0030) on the step that i am willing to bypass only after the previous step
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Dec 01, 2010 11:36 pm
Reply with quote

How large will the data set be? If it is small, a little piece of Rexx might be an option. Otherwise, I believe that you can set the return code in DFSORT and Syncsort based on the presence of a string in a record, although as usual I will defer to Messrs. Yaeger and Kolusu, and to Ms. Margulies, as to the exact capabilities and limitations of those utilities.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Dec 02, 2010 12:10 am
Reply with quote

If SAS® 9.2 Companion for z/OS® is installed you could use :

ABORT RETURN <n>;

where <n> is the return code.
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: Thu Dec 02, 2010 12:45 am
Reply with quote

Hello,

See if something like this will do what you want:
Code:
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DUMMY
//SYSIN DD *
  OPTION COPY,NULLOUT=RC4
  INCLUDE COND=(1,80,SS,EQ,C'ABEND')


Read about NULLOUT in the documentation.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Dec 02, 2010 10:28 am
Reply with quote

May be an OMIT COND can be used instead if you want RC=4 if 'ABEND' is found and RC=0 when 'ABEND' is not found.
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

 


Similar Topics
Topic Forum Replies
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts force tablespace using LISTDEF input DB2 1
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
Search our Forums:

Back to Top