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

How to set retun code in a Natural Batch program


IBM Mainframe Forums -> Java & MQSeries
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shreevamsi

Active User


Joined: 23 Feb 2006
Posts: 305
Location: Hyderabad,India

PostPosted: Wed May 28, 2008 10:53 am
Reply with quote

Hi,

Could anybody help me know how to set the return code for a succesful execution of a Natural Batch program so that i can handle the return code in the subcequent steps in JCL.

Thanks,
~Vamsi
Back to top
View user's profile Send private message
shreevamsi

Active User


Joined: 23 Feb 2006
Posts: 305
Location: Hyderabad,India

PostPosted: Wed May 28, 2008 11:14 am
Reply with quote

Hi,

I understand from the previous post that there are no special registers, like in Cobol where we can set the retrun code for a Natrual Batch programs.

Thanks,
~Vamsi
Back to top
View user's profile Send private message
Catherine Gutowski

New User


Joined: 02 Oct 2008
Posts: 1
Location: Dallas, TX

PostPosted: Thu Oct 02, 2008 9:34 pm
Reply with quote

I realize this is a really old post, but the info is not correct so I wanted to make sure the next person using google to find this info got the right answer.

In a batch Natural program, you can use TERMINATE 33 to send a return code 33 to the JCL. I believe it will stop execution of your Natural program at that point (acting like an ESCAPE IMMEDIATE function), but if you define the JCL to accept 33 as a return code, it will allow the remaining jobsteps to continue processing.


Here is sample code:

/* IF NO DATA THEN STOP THE PROGRAM
IF #COUNT-GOODREC EQ 0
TERMINATE 33
END-IF

We use this to run a batch job everyday, look for records, and if none found, then stop the program with 33. The JCL for the email notice then evaluates the COND code of the natural step and if it is 33 it doesn't execute the step to send the email notification. We only want to be notified if there are records.

Not sure why 33 is the chosen number, but it works. If I recall correctly, it didn't work with other numbers, but it's been a long time and I dont' remember. Note that you will have to set your job up to allow 33 as a valid return code, and in our shop that meant that our normal abend codes of 4, 8 and 12 became invalid as abend codes, since we had to state that 33 was the highest valid return code. In our case, this was only a report so it was not mission critical if it really abended, and of course we programmed it so well that we handled all possible bad data conditions in the program without causing an abend :-)
Your shop may be different and may allow specific codes to be defined.

Also - there is another way to abend a natural program, either online or batch: MOVE 9974 to *ERROR-NR
or you can use the old tried and true divide by 0. Both of these will cause an abend of the step in the batch job, which may not allow you to continue processing your steps. Not sure which error code they return.
Back to top
View user's profile Send private message
helga

New User


Joined: 11 Sep 2006
Posts: 23

PostPosted: Tue Oct 07, 2008 2:19 am
Reply with quote

Quote:
you can use the old tried and true divide by 0
not always . . .
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Oct 07, 2008 3:31 am
Reply with quote

Quote:

not always . . .


ok, I'll bite. How come?
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Tue Oct 07, 2008 10:49 am
Reply with quote

Because you might customize Natural to trap an abend and produce an RC for it. Don't forget that you are not invoking a Natural program, but the Natural Nucleus.

O.
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 -> Java & MQSeries

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
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 How to get a stack trace on a looping... ABENDS & Debugging 5
No new posts Calling Java method from batch COBOL ... COBOL Programming 5
Search our Forums:

Back to Top