Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to set retun code in a Natural Batch program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Java & MQSeries
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    Post subject: How to set retun code in a Natural Batch program
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    Post subject: Reply to: How to set retun code in a Natural Batch program
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    Post subject: Yes you can
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    Post subject: Reply to: How to set retun code in a Natural Batch program
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: 6968
Location: porcelain throne

PostPosted: Tue Oct 07, 2008 3:31 am    Post subject:
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: 2360
Location: Israel

PostPosted: Tue Oct 07, 2008 10:49 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Java & MQSeries All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Accessing CICS tran with map from JCL... navdeepaggarwal CICS 5 Tue Oct 03, 2017 6:15 pm
No new posts Speed-up/reduce CPU use of code prino PL/I & Assembler 0 Tue Sep 26, 2017 12:05 am
No new posts Generate public-private key in batch ... vasanthz All Other Mainframe Topics 3 Fri Sep 15, 2017 9:20 am
No new posts Working with hex values in Filemanage... Emile Straker IBM Tools 0 Tue Sep 12, 2017 1:42 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us