Page 1 of 1

Interacting With An Already Running CICS Transaction

PostPosted: Wed Jun 30, 2010 8:55 pm
by kev22257
Hello,

I'm trying to figure out the best way to implement the following. Sorry for the length. If you're not a detail person read the last sentence first.

I have a CICS program, written in Java, that makes connections out to another service outside our mainframe via TCP. I want another CICS program, written in say COBOL, to be able to send a unit of work to the Java program for it to send out to the external service. I do not want to execute a link or a start for each unit of work because I'm trying to avoid starting and tearing down a connection in the Java program each time the COBOL program wants to send out some data. It's not an option for the COBOL program to communicate out over TCP directly to the external service.

I've come up with two options, both of which I don't really like.

1. Have the Java program monitor a queue inside CICS in which the COBOL program could put work onto. I'd read the queue and if there is data process it. If there is no data I'd have to sleep on an interval and they try the read again. I don't like this because this process needs to be as quick as possible and so I don't want anything polling for work. If i slept for five seconds on an empty queue and data came over to process while I was sleeping my process wouldn't wake up until the entire five seconds elapsed.

2. Have the Java program listen on a socket which the COBOL program would connect to and send it's work over through. I like this a little better because in Java a read to a socket blocks; this means that until there is data available the program hangs on the read. The blocking would be perfect except listening on a port and setting CICS up to handle the socket is annoying. Plus I'd have to expose that port on at least the lookback interface and I'm trying to keep all the processing hidden from anything outside the region.

What I think would be perfect is some combination of the two where I could do a read on say a TS queue that, instead of returning an empty queue error, would just block until data arrived. As far as I can tell though this isn't possible.

So the short of it is that I'm looking for a way for another program to be able to send data into an always running CICS task which is listening/ waiting for work.

Thanks,

Kevin

Re: Interacting With An Already Running CICS Transaction

PostPosted: Wed Jun 30, 2010 10:27 pm
by enrico-sorichetti
why would You want to reinvent the wheel ...

no need to have a task sitting there doing nothing
use MQ and have a task triggered by a message sent to the proper queue
or You might want to use TD with a trigger

after the receiving task has been triggered by a MQ or TD put
keep reading the queue until there are no more messages/records and exit

the only way to implement what You want is to use TD/TS with a wait/post infrastructure

on the receiving side
at start enter a Wait on some event control block
at post start reading the <message queue>
at end of queue enter a wait state

on the sending side
write the <message queue>
post the event control block

depending on the expected message rate it might get tricky
see
http://publibz.boulder.ibm.com/cgi-bin/ ... 0619105120
and
http://publibz.boulder.ibm.com/cgi-bin/ ... 0612172134

for the POST/WAIT implementation logic

Re: Interacting With An Already Running CICS Transaction

PostPosted: Wed Jun 30, 2010 10:31 pm
by enrico-sorichetti
follow on / correction

the only way to implement what You want is to use TD/TS with a wait/post infrastructure


should read

the only way to implement what You want without a task detach/attach is to use a wait/post infrastructure
with a properly chosen message support architecture ... TD/TS/sql table/vsam file
( i do not know enough about it, but even a MQ might be used to store the message data )

Re: Interacting With An Already Running CICS Transaction

PostPosted: Wed Jun 30, 2010 10:53 pm
by kev22257
Hi and thanks for your reply.

I should have mentioned that what I'm trying to do is not use WebSphere MQ because we won't be getting a license for it (read: $$). I'm putting a set of programs together to enable CICS applications to talk over ActiveMQ.

http://activemq.apache.org/

I read about your suggestion on POST and WAIT and unfortunately, since my receiving program is written Java, don't think I can leverage that functionality. I only have access into CICS from Java through what's available in the jCICS library and I don't see anything for interacting with an ECB.

http://publib.boulder.ibm.com/infocente ... hpkb00.htm

Kevin