Hello,
Please have an example of how to get the return code set by a natural program into JCL /Job.
Thanks
Hello,
Please have an example of how to get the return code set by a natural program into JCL /Job.
Thanks
From Natural Documentation:
Function
The TERMINATE statement is used to terminate a Natural session. A TERMINATE statement may be placed anywhere within a Natural program. When a TERMINATE statement is executed, no end-of-page or end-loop processing will be performed.
For Natural RPC: See Notes on Natural Statements on the Server in the Natural RPC (Remote Procedure Call) documentation.
Syntax Description
Operand Definition Table:
Operand Possible Structure Possible Formats Referencing Permitted Dynamic Definition
operand1 C S N P I yes no
operand2 C S A A U N P I F B D T L C yes yes
Syntax Element Description:
Syntax Element Description
operand1
operand1 may be used to pass a return code to the program receiving control when Natural terminates. For example, a return code setting may be passed to the operating system via Register 15.
The value supplied for operand1 must be in the range 0 - 255.
operand2 operand2 may be used to pass additional information to the program which receives control after the termination.
Program Receiving Control after Termination
After the termination of the Natural session, the program whose name is specified with the profile parameter PROGRAM will receive control.
If you are asking what the IBM Mainframe JCL looks like to check the return code specified on the Natural TERMINATE statement, you use the COND parameter on the JCL EXEC statement. There are lots of formats and ways to use it, so you should read about it in a JCL manual or a book on the subject. If you don’t have access to one, here’s a link to one on an IBM web site.
[url]https://www.ibm.com/support/libraryserver_os390/handheld/Connected/BOOKS/IEA2B570/CCONTENTS?[/url]
And a link to an IBM mainframe forum:
[url]JCL & VSAM -IBM Mainframes
Hope that helps,
George
Hi,
Thanks for the replies.
My scenario or the solution I was looking that how to receive a return code set in natural program using the TERMINATE statement into JCL.
Its same like in cobol, creating a value for the special register “RETURN-CODE” like,
MOVE 04 TO RETURN-CODE , and the Job will end up with a return code of ‘04’ irrespective of the actual termination code returned by the program.
So, I assume here from the previous replies,
If I use,
TERMINATE 04 in a natural program will terminate the session and the job which used to run the same will throw a return code of MaxCC of 04.
Correct me if I am wrong.
Thanks.
A little off-topic, but …
Beware that TERMINATE will not cause a step ABEND. As far as the operating system is concerned, the step ends normally. For datasets, that means the NORMAL-TERMINATION-DISPOSITION is taken.
DISP=(NEW,CATLG,DELETE)
Your datasets will CATLG, not DELETE.
ps Yes, Unnikrishnan. You will see “MAXCC=0004”.