Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Using WAIT EVENT and POST

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
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    Post subject: Using WAIT EVENT and POST
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.

http://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.

http://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: 2150
Location: At my coffee table

PostPosted: Tue Jul 06, 2010 8:39 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue Jul 06, 2010 9:15 pm    Post subject: Reply to: Using WAIT EVENT and POST
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Job to wait and continue based on reply yugendran COBOL Programming 5 Wed Oct 05, 2016 1:46 pm
No new posts Creating an 'Enter' event with IMS MF... dileep chirasani Java & MQSeries 1 Sat Aug 06, 2016 2:23 am
No new posts Event-driven programming (BTS) VS (ST... Rohit Umarjikar CICS 2 Sat Jun 11, 2016 2:05 am
No new posts How to detect file creation event? vasanthz All Other Mainframe Topics 5 Fri May 20, 2016 1:33 am
No new posts OMEGAMON to see In-DB2 times and Wait... Archana89 IBM Tools 4 Fri Mar 04, 2016 11:28 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us