Problem solve Get help with specific problems with your technologies, process and projects.

How does pgmc data get back to my user program using CWS?

I'm writing a CWS user program and I'm having trouble understanding how my process gets back to the user program. The BLI LINKs to the user program that the analyzer specified and passes a COMMAREA with the information in it. I skipped the decode so the COMMAREA contains the request in its original form.

From my user program I have a process to complete that is currently kicked off by SNA and consists of pgma, which xclts to pgmb, which xclts to pgmc. Pgmc does a SEND and RETURN. SNA picks up the response data from the send and sends it back to the user of the request.

How does pgmc data get back to my user program using CWS?

The short answer is that it can't! Not very helpful but here is some background (all this is in the Internet Guide).

You have a TCPIPSERVICE defined that will start a CICS-supplied transaction that goes those various stages. Essentially, you get called by the analyzer stage that you use to set the converter program that will service the request. You supply the analyzer and the converter. Before the REAL application program that you want to run, the converter goes through the decode stage (which you use to fiddle about with the input flow) where you set the commarea to be sent to the REAL application program. The next stage links to this REAL application program with the commarea. Then this REAL application program does the 'biz and returns with a commarea. The last stage in processing is to call the converter for the encode stage where you can amend the flow to be returned just before the results are returned over the socket.

Consequently, the thing you are concerned about -- the REAL application program -- will function exactly like an XC LINK PROG() COMMAREA(...). And, this means that you cannot do anything outside of the current transaction. That's why you cannot do what you require.

Therefore, this boils down to the ages-old problem of getting synchronization between two running transactions -- A starts B and needs to wait until B ends before it can proceed with something returned by B.

There are all sorts of traditional mechanisms to do this but nowadays I use the BTS function of CICS to do this. There are some earlier appends to this forum covering BTS and one of my papers on the CICS Web site talks about this (under the guise of BigCommarea processing).

In your case, in the REAL application program:

* Create a BTS Process (with a unique name)
* Define this Process to run the required asynchronous operation
* Stick the data to be passed into a process-level container
* Start the process to run asynchronously
* Poll until this process finishes
* Grab the returned data from another (or the same) process-level container
* Kill off the process (IMPORTANT, as it will stay around until physically deleted)
* Return this info in the commarea

The process to be run is essentially a wrapper to this existing SNA-based process:

* Get the startdata
* Tell BTS that you have got going
* Get the information from the process-level container
* Use this information for the SNA-based activity
* Run this SNA-based process
* Put the returned information from the SNA-based process into the process-level container
* End

I think you need this indirection because of the way you describe your situation. I may have not correctly understood but from the way you describe it, this SNA-based process is difficult to control from the REAL application program or else why are things not already succeeding.

Robert Harris
CICS Technical Strategist -- CICS expert at Search390.com

Editor's note: Do you agree with this expert's response? If you have more to share, post it in one of our .VO7aaqqaAFk.0@/search390>discussion forums.

Dig Deeper on IBM system z and mainframe systems

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.