CICS to Natural

I am trying to have a cics program transfer control to a natural program that will display a menu. When i press the CLR key to end the natural program it tell me that the natural session terminated normally, but when i try to sign off of cics it will bring the natural program back up. Anything i do will bring up the natural program. Is something i can do that will end the session, so that it won’t keep bringing up the natural program again.

What method are you using to start the Natural session? Is it the 3GL interface, or EXEC CICS START, or LINK, or XCTL? How Natuarl is invoked determines what how & what transaction is set for the next CICS request.

You should also look at the Natural profile parameter “PROGRAM”, and the sample programs in Natuarl library SYSEXTP calledPROGSET, and TRANSET.

Hope that helps a little.

darrell,

I am using a xctl to start natural. When i clr out of the natural pgm and it goes back to cics is there a way to change the pf-key from clr to something else so i can check that in the eibaid?

When invoking NATURAL via XCTL please observe the following rules:

Front-End Invoked via XCTL

If the Natural session is initiated from a front-end program with XCTL and no return program is specified (that is, neither a fifth parameter in the session startup parameters nor a PROGRAM specification in the Natural dynamic parameters or the NTPRM macro), Natural restarts the user front-end transaction at session termination via RETURN with TRANSID by internally simulating a PROGRAM=‘RET=xxx’ specification, with xxx being the front-end transaction code.

To avoid a loop condition, logic must be included into the user front-end routine to decide whether a new session is to be started or an old session is to be resumed.

The ability to have Natural change the PF-KEY that CICS sees is somewhat limited and may be considered “tricky” by some. The SET CONTROL ‘Knn’ only changes what Natural sees as the PF key, not the CICS EIB value, so that is not what you want. Perhaps a non-conversational write would put it back to ENTER from CLEAR (and I have not tired this, so don’t bet on it… but…). A simple way to test it is to

STACK TOP DATA FORMATTED ’ ’ /* stack a single blank
INPUT #A1 /* receive that blank non-conver.
TERMINATE

Or, perhaps

SET CONTROL ‘N’
INPUT #A1
TERMINATE

But in your instance, a much better way than altering the PF-key would be to use the backend program option mentioned previously. When Natural quits it goes to that specific termination program where you can do whatever you like, including change the EIB key value and terminate.

Yet another possible method is to use the CMTRNSET (coupled with CMTASK) as described in volume II of the Natural Installation manual under the heading “Dummy Screen I/Os with Natural/CICS”. This lets you change the “restart” transaction used by CICS so that it does not re-invoke your Natural session. Instead it can, for example, invoke the signoff (CSSF) transaction directly, or another non-Natural CICS transaction that “cleans up” after Natural is done.

One last note, I hope this method of getting to Natural (using XCTL) is a limited-use application. Starting and stopping Natural for a single screen is not efficient! It has to allocate buffers, check securtiy, do the logon, and connect to the nucleus and bufferpool, allocate a slot in the user control block, etc. etc… If this a heavily re-used menu, a better method is the 3GL interface, and tou might want to look into that option.