ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » Mainframe, CICS, TXSeries » need opinion on MQ program.

Post new topic  Reply to topic
 need opinion on MQ program. « View previous topic :: View next topic » 
Author Message
Umeshrath
PostPosted: Wed Apr 26, 2006 10:30 am    Post subject: need opinion on MQ program. Reply with quote

Novice

Joined: 27 Dec 2005
Posts: 23
Location: Hyderabad

Hi All,

My requirement is to drain a queue based on certain condition in batch enviornment.

Read a record.
If value = a then delete that record from the queue else dont delete the record.

What i have thought of?

ØFirst i will do an MQ enquire to know the current depth.

ØIf the current depth is “N “ then we will do MQGET “N “ times.

Ø If the condition satisfied then do nothing else
write the record to the queue.

I want opinion about this logic.
If anybody have better idea than this then please share it with me.
Regards,
Umesh
_________________
Umesh Rath
Back to top
View user's profile Send private message Send e-mail
wschutz
PostPosted: Wed Apr 26, 2006 10:45 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

Well.. first, you can't trust CURDEPTH to predict how many message your program will be able to MQGET. The reason for this have been explained here in MQSeries.net.

So you want to remove messages if they meet a certain requirement? A better model would be to BROWSE the messages and then if you want to remove the message use MQGMO_MSG_UNDER_CURSOR. You can BROWSE the queue until you've processed all the messages,
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
Umeshrath
PostPosted: Thu Apr 27, 2006 6:16 am    Post subject: Reply with quote

Novice

Joined: 27 Dec 2005
Posts: 23
Location: Hyderabad

can you throw some more light on MQGMO_MSG_UNDER_CURSOR.

What i understand from that i will first do MQGET with browse option and then when ever my condition will be met then i will do a destructive MQ get.

But i think by this method the cursor position will be lost.

Please elaborate on this approach.

Thanks a lot.

Regards,
Umesh
_________________
Umesh Rath
Back to top
View user's profile Send private message Send e-mail
PeterPotkay
PostPosted: Thu Apr 27, 2006 6:21 am    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7717

Umeshrath wrote:
can you throw some more light on MQGMO_MSG_UNDER_CURSOR.


http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Apr 27, 2006 6:29 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Here's a clue - in the link PeterPotkay sent, you should be looking in and around where it says this:

Quote:
The MQGMO_MSG_UNDER_CURSOR option can subsequently be used with a nonbrowse MQGET call if required, to remove the message from the queue.

The browse cursor is not moved by a nonbrowse MQGET call using the same Hobj handle. Nor is it moved by a browse MQGET call that returns a completion code of MQCC_FAILED, or a reason code of MQRC_TRUNCATED_MSG_FAILED.


I'm interesting in the design of your code. You've got a queue where you're reading through it, looking for a particular condition in the data, destructively reading all those messages which conform to the condition and leaving all those that don't. What reads off all the other messages? Is it another similar application?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
wschutz
PostPosted: Thu Apr 27, 2006 6:57 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

Umeshrath wrote:

But i think by this method the cursor position will be lost.

No, doing the destructive GET does not loose the browse cursor.
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
Umeshrath
PostPosted: Thu Apr 27, 2006 9:01 am    Post subject: Reply with quote

Novice

Joined: 27 Dec 2005
Posts: 23
Location: Hyderabad

Hi All,

My requirement is that if the records are more than 24 hours old then delete that record from the queue else dont do anything.
_________________
Umesh Rath
Back to top
View user's profile Send private message Send e-mail
vennela
PostPosted: Thu Apr 27, 2006 9:31 am    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

Then why not set the expiry on the message?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Umeshrath
PostPosted: Thu Apr 27, 2006 9:45 am    Post subject: Reply with quote

Novice

Joined: 27 Dec 2005
Posts: 23
Location: Hyderabad

Is there any method to set the expiry time for the message?

Is this the job of the administartor or we can do something programatically?

Expiry date means the record will be automatically deleted after 24 hours it got written into the queue.

Please confirm.

Regards,
Umesh
_________________
Umesh Rath
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Thu Apr 27, 2006 9:57 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Expiration is set by the program on the message.

Messages that have expired are removed by the qmgr at various points in time - the only guarantee given is that no application will ever GET an expired message. On z/OS there are processes that will periodically scan queues and remove expired messages. On other platforms, the behavior is more dependent on version.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Umeshrath
PostPosted: Thu Apr 27, 2006 6:47 pm    Post subject: Reply with quote

Novice

Joined: 27 Dec 2005
Posts: 23
Location: Hyderabad

Hi Jeff,

Can u just throw some more light how to set the expiry time for a message programmatically? If u have some sample code then that will help a lot.

Thnaks a lot.

Regards,
Umesh
_________________
Umesh Rath
Back to top
View user's profile Send private message Send e-mail
kevinf2349
PostPosted: Thu Apr 27, 2006 7:01 pm    Post subject: Reply with quote

Grand Master

Joined: 28 Feb 2003
Posts: 1311
Location: USA

Read the Application Programming Reference manual. It is clearly documented in there.

You will learn best from doing things yourself. You aren't Jeevan are you?
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Apr 27, 2006 10:53 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Using expiry also allows you to be far more flexible; expiry times can be set to different values according to message. Maybe not a requirement not, but as soon as someone finds out messages go automatically after 24 hours their message will need to be deleted sooner or later than that.

Also removes all the scheduling problems from your program (when to run it, what to do if it fails, etc, etc) and bungs it all onto the queue manager. Where it belongs.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » Mainframe, CICS, TXSeries » need opinion on MQ program.
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.