How to process the last msg in MQ?



Support for MQSeries and Websphere Message Oriented Middleware communication systems for z/OS

How to process the last msg in MQ?

Postby saintsinner » Fri Sep 03, 2010 3:01 pm

Hi.. I have a requirement where I need to process the last MQ msg in the Q. The reply to every msg. is the same. Currently the CICS program is designed in such a way that it just reads the first available message, processes it and thats it. It doesnt check to see if there is another message in the Q. The problem with this is, when the CICS is down, the message Q gets built up since the sending system sends message multiple times in a day (for instance, a msg every hour). So, I need to change the program to keep reading the Q till it gets to the last msg. and then process the last msg. What I do not know is, does MQGET populate the message fields with spaces or low-values when there is no msg. left or it will hold the contents of the last successful read? In the former case, I will have to store the msg contents for every MQGET in a temporary WS vairable. In the latter, I need not. Please let me know which is the legitimate way.
saintsinner
 
Posts: 2
Joined: Fri Sep 03, 2010 2:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to process the last msg in MQ?

Postby NicC » Fri Sep 03, 2010 3:41 pm

I am unclear on your requirements - do you want to just access only the last message or do you want to process all the messages in the queue?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: How to process the last msg in MQ?

Postby dick scherrer » Sat Sep 04, 2010 12:12 am

Hello,

What should happen with the messages that are not the last message?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: How to process the last msg in MQ?

Postby saintsinner » Mon Sep 06, 2010 7:23 pm

Since every message in the queue is meant to get the same information, I want to access and process the last (the latest incoming msg) in the queue. Once I am done with processing the last message, I want to delete all the messages. So, I should be able to either read messages in a sequence and delete every message I have read, until I reach the last message OR I can directly access the last message, process it and then delete all the messages in the queue. Either way is ok, however, the latter option sounds better than the former.
saintsinner
 
Posts: 2
Joined: Fri Sep 03, 2010 2:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to process the last msg in MQ?

Postby dick scherrer » Mon Sep 06, 2010 10:49 pm

Hello,

Read each message, store the message in ws, delete the message.

When there are no more, used the stored info to do whatever is needed.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: How to process the last msg in MQ?

Postby littlechicken » Wed Nov 10, 2010 10:58 am

saintsinner wrote:Hi.. I have a requirement where I need to process the last MQ msg in the Q. The reply to every msg. is the same. Currently the CICS program is designed in such a way that it just reads the first available message, processes it and thats it. It doesnt check to see if there is another message in the Q. The problem with this is, when the CICS is down, the message Q gets built up since the sending system sends message multiple times in a day (for instance, a msg every hour). So, I need to change the program to keep reading the Q till it gets to the last msg. and then process the last msg. What I do not know is, does MQGET populate the message fields with spaces or low-values when there is no msg. left or it will hold the contents of the last successful read? In the former case, I will have to store the msg contents for every MQGET in a temporary WS vairable. In the latter, I need not. Please let me know which is the legitimate way.


this sounds like a production problem in the making and a potential disaster. WHy write messages and then never read them only the last you do not mention the secanrio of messages being written tot eh queue.

You could always have a trigger level of 1 then it would start one txn per message received.
littlechicken
 
Posts: 25
Joined: Thu Oct 28, 2010 10:15 am
Has thanked: 0 time
Been thanked: 0 time


Return to WebSphere MQ