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