IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Using WAIT EVENT and POST


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kev22257

New User


Joined: 30 Jun 2010
Posts: 7
Location: Keene, NH

PostPosted: Tue Jul 06, 2010 8:25 pm
Reply with quote

Hi,

First off I'm sorry my post is so confused, but so am I :-)

I'm trying to use WAIT EVENT and POST to have transaction A, which is invoked by a user, wake up transaction B, which is started and always running. The idea is was to WAIT EVENT inside transaction B and then have transaction A post to get B to do some work. Once B was done he'd loop back around to the WAIT EVENT and go to sleep again.

I thought this was the right way to go, but I guess maybe I'm missing something about how EVENT/ POST works? The documentation isn't really good on the IBM site. Perhaps because this style of transaction affinity is founded upon.

Is it really just that POST only works with times and intervals and that's why I'm getting hung up? I'm open to doing this other ways, but it was suggested to me that this might be the way to go.

My confusion I guess is that POST creates the ECB and gives me an address, but I should be in WAIT EVENT before the POST happens. Do I POST twice?

The documentation here leads me to believe I can do what I want.

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DFHP3C00/3.6.4.5?SHELF=DFHASJ00&DT=20070619105120

The documentation here on how POST works leads me to believe I can't.

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DFHP4C00/1.162?SHELF=DFHASJ00&DT=20070612172134

Thanks,

Kevin
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Jul 06, 2010 8:39 pm
Reply with quote

Is there going to be a problem with multiple CICS regions? I.e., tranB waiting in one while tranA posting another?
Quote:
I thought this was the right way to go
Why when trana could just start tranB would be much simpler?
Or tranA could put to a TDQ that triggers tranB.
Guaranteeing tranB will always be there for tranA requires a program start in the PLTPI and additional complicated code somewhere to restart tranB if it ever fails.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jul 06, 2010 8:40 pm
Reply with quote

does tran A require a response from tran B?
Back to top
View user's profile Send private message
kev22257

New User


Joined: 30 Jun 2010
Posts: 7
Location: Keene, NH

PostPosted: Tue Jul 06, 2010 8:56 pm
Reply with quote

First off; thanks for your responses!

@CICS Guy
- There will not be a problem with multiple CICS regions.
- Transaction B can't start transaction A. I'll explain below.
- There is already recovery and PLT configurations in place to make sure this is the case.

@dbzTHEdinosauer
- No it does not.

Let me better explain what I'm doing. I'm writing an outbound interface for ActiveMQ. I have a transaction, transaction B, that starts up with the region and makes and outbound connection to a destination in ActiveMQ. This program is written in Java. It needs to stay running, that is it can't be started every time by transaction A, because flooding the ActiveMQ server with connections would absolutely kill it and because CICS really isn't built to support ActiveMQ I can't use traditional connection pooling.

The idea is to have transaction B sleeping. Transaction A would load n messages to a TD queue and then wait up transaction B. Transaction B would process and send the messages from the TD queue out to the ActiveMQ broker and then go back to sleep.

Kevin
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jul 06, 2010 9:06 pm
Reply with quote

well I can understand your problem with the java and ?cobol? interface,
but the reason I asked:

what happens if the queued (msgs sent by Tran A to tdq) msgs are not sent by TRAN B?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Jul 06, 2010 9:15 pm
Reply with quote

please do not post about the same issue on multiple forums ?
will not get you more or better answers
Back to top
View user's profile Send private message
kev22257

New User


Joined: 30 Jun 2010
Posts: 7
Location: Keene, NH

PostPosted: Tue Jul 06, 2010 9:15 pm
Reply with quote

@dbzTHEdinosauer
I guess they would stay in the TD queue which would be marked as recoverable. I know there are probably other problems with the design, but I'm at least trying to get a proof of concept going.

You are right in assuming it's Java and COBOL. As a matter of fact Java does not have access to the WAIT EVENT and POST commands in CICS so I had to build little stub programs to expose them.

Thanks again,

Kevin
Back to top
View user's profile Send private message
kev22257

New User


Joined: 30 Jun 2010
Posts: 7
Location: Keene, NH

PostPosted: Tue Jul 06, 2010 9:17 pm
Reply with quote

@enrico-sorichetti
If you are referring to my other post on ibmmainframeforums.com then I'm sorry, but my company blocks that website, you know because it's a forum and those are evil. I originally posted to it from home.

Kindly close the thread on the other forum.

Thanks,

Kevin
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jul 06, 2010 9:22 pm
Reply with quote

Kevin,

My concern is msgs on queue, Tran B starts,
removes item from queue,
unable to send message over ActiveMQ,

what happens to the lost message?
Back to top
View user's profile Send private message
kev22257

New User


Joined: 30 Jun 2010
Posts: 7
Location: Keene, NH

PostPosted: Tue Jul 06, 2010 9:24 pm
Reply with quote

@dbzTHEdinosauer
There would have to be some syncpoint stuff in there to roll it back. I'm not worried about losing messages yet until I prove that the WAIT EVENT and POST stuff will even work.

Thanks,

Kevin
Back to top
View user's profile Send private message
kev22257

New User


Joined: 30 Jun 2010
Posts: 7
Location: Keene, NH

PostPosted: Wed Jul 07, 2010 1:33 am
Reply with quote

Well I figured it out. Here's what I did.

1. Do a GETMAIN for one full-word of storage saving the address off for later. Make sure to make it SHARED so other transactions can see it.

Code:

EXEC CICS GETMAIN                               
          SET(WS-ADDRESS)
          FLENGTH(1)                           
          SHARED                               
END-EXEC                                       


2. Initialize the storage from part 1 to binary zeroes. Define a working-storage variable as S9(08) COMP and then ADDRESS OF it to the address from the GETMAIN.

Code:

SET ADDRESS OF WS-VARIABLE TO WS-ADDRESS


3. Do a WAIT EVENT on that address.

Code:

EXEC CICS WAIT                 
          EVENT                 
          ECADDR(WS-ADDRESS)
END-EXEC                       


4. From another transaction get addressability the storage and set the first and third bytes to x'40 and x'80' respectively. I created a variable as in step 2 and then put a redefine of PIC X(04) on it. From there I could use reference modification to set the HEX values.

Code:

MOVE X'40' TO WS-VARIABLE-X(1:)
MOVE X'80' TO WS-VARIABLE-X(3:)


My problem was I was trying to use WAIT EVENT and POST together, but really all I needed to do was use WAIT EVENT and manually post the ECB.

This is what is outlined in the CICS Application Programming guide on page 164 in the "Using the WAIT EVENT command" section, but it didn't provide enough detail so I didn't quite get it until I figured it out for myself.

Thanks everyone for your help.

Kevin
Back to top
View user's profile Send private message
Earl Haigh

Active User


Joined: 25 Jul 2006
Posts: 475

PostPosted: Wed Jul 07, 2010 1:51 am
Reply with quote

[quote]This program is written in Java[/quote

YUK. You should write in COBOL or Assembler

as suggested earlier, use TD queue to trigger transaction that
needs to send messages to ActiveMQ. Set trigger level on the TDQ
definition at high enough value that flooding is not a concern. Perhaps 100 or even 1,000

I have used wait event and posts in the past and they do work, but
your right, the documentation is not real clear. Its been a couple of years, and I would have to go back and review docs myself before using again.

If you feel you must use a long running transB, then I would code a loop
on a time delay, that wakes up every 30 seconds or so and look for data on a posted from TransA on Q. (Suggest using temp.storage-TSQ rather than transient data TDQ)
Back to top
View user's profile Send private message
kev22257

New User


Joined: 30 Jun 2010
Posts: 7
Location: Keene, NH

PostPosted: Wed Jul 07, 2010 1:59 am
Reply with quote

@Earl Haigh
Thanks for your comment!

As many of the programs that can be are in COBOL, including the entire waiting process described above, but to talk to ActiveMQ it has to be Java.

The Java performance inside CICS is really quite good and the programs are kept simple enough that it seems to work quite well.

Kevin
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 07, 2010 2:24 am
Reply with quote

Kevin,

my hat is off to you for your efforts and thanks for providing a solution.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts DB2 Event passed to the Application P... DB2 1
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Wait for job rc CLIST & REXX 10
No new posts Help with CA7 Post Command CA Products 0
No new posts How to get RBA value from CICS EVENT CICS 6
Search our Forums:

Back to Top