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 » Open a Queue for Browse and Destructive Get

Post new topic  Reply to topic
 Open a Queue for Browse and Destructive Get « View previous topic :: View next topic » 
Author Message
colohal
PostPosted: Wed Nov 16, 2005 10:23 am    Post subject: Open a Queue for Browse and Destructive Get Reply with quote

Newbie

Joined: 16 Nov 2005
Posts: 1

New to MQ, we need to first browse a message to establish the length, then allocate storage, then get the message off the queue. Do we need to open the queue twice using MQOO-BROWSE then MQOO-INPUT-EXCLUSIVE for example, or is there a way to only open once and perform both MQGET calls? Any ideas out there?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Nov 16, 2005 10:30 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

The typical way this is handled is to specific an initial buffer of size 1, run a destructive GET - which will throw an error but return the proper length, and then allocate storage and redo the get.

The other option is to always allocate the largest possible buffer, and then reblock after the get is successful.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
EddieA
PostPosted: Wed Nov 16, 2005 10:42 am    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
The typical way this is handled is to specific an initial buffer of size 1

Well, that's a way. It would depend on where you were going to get the storage from, and how random in size the messages are. If you are going to have to make requests to CICS, then I'd go for the approach of allocating a buffer that will accomodate all but the "exceptional" size messages, and for those grab the additional storage and re-GET.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Nov 16, 2005 11:24 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I knew I should have said "But I'm not a mainframe programmer."
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
wschutz
PostPosted: Wed Nov 16, 2005 11:36 am    Post subject: Reply with quote

Jedi Knight

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

Jeff... why not an inital buffer size of 0? Do you get many 1 byte messages????
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
jefflowrey
PostPosted: Wed Nov 16, 2005 11:48 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

wschutz wrote:
Jeff... why not an inital buffer size of 0? Do you get many 1 byte messages????


Off by one error...
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
zpat
PostPosted: Thu Nov 17, 2005 12:20 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5849
Location: UK

You could browse with ACCEPTED_TRUNCATED_MESSAGE.

If you repeat an unconditionalMQGET then you might get a entirely different message if any other program was also processing the queue at the same time.

Getting that same message by MSGID is one way to ensure that you get the same message (unless another program has already removed it in which case you just browse the next).
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 » Open a Queue for Browse and Destructive Get
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.