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 » General Discussion » Multiple messages with MQGET

Post new topic  Reply to topic
 Multiple messages with MQGET « View previous topic :: View next topic » 
Author Message
LearnMQSI
PostPosted: Tue Oct 22, 2002 8:55 am    Post subject: Multiple messages with MQGET Reply with quote

Centurion

Joined: 20 Aug 2002
Posts: 137

Hi There,

I have multiple messages sitting in a local queue. I have to read every message and perform some other processes and than perform and MQPUT in a Reply-Queue and than go back into the loop to read the next message from the local queue.

Here is High-Level Logic/Pseudocode for my Program.

QUEUE_EMPTY := 'FALSE'

WHILE NOT QUEUE_EMPTY LOOP
MQGET(..................)
IF REASON := 2033 THEN
QUEUE_EMPTY := 'TRUE';
EXIT;
END IF;
get the detail info for the message has been read in the DB
MQPUT(...........) into the Reply_Queue (Remote Queue)
END LOOP;

Ofcourse, I have opened required queues with the proper open options.

My WHILE LOOP is performing only once.

Any clue or solution to the above will be greatly appreciated.


Thanx,
Back to top
View user's profile Send private message
bower5932
PostPosted: Tue Oct 22, 2002 10:21 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

Without seeing the actual code, I would guess that you are getting the first message which is setting the MessageId and CorrelationID. When you come back again, these are now set and there isn't a match for your message so you fall out of your loop.

This is just speculation. If you could post the actual code around the MQGET, it would be helpful.

You could also look at the amqsget0.c sample. It gets all messages out of a queue.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
bduncan
PostPosted: Tue Oct 22, 2002 11:22 am    Post subject: Reply with quote

Padawan

Joined: 11 Apr 2001
Posts: 1554
Location: Silicon Valley

Another thing to watch for, though it may not apply to your situation, is when you have the wait interval set too low. No matter how low your wait interval is, your application will always get all the messages currently on the queue before receiving a 2033. But, if the queue doesn't already have the messages sitting on it, i.e., they are coming in as the program is running, then your wait interval may be so low that your application gives up moments before the next message arrives on the queue.
_________________
Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator
Back to top
View user's profile Send private message Visit poster's website AIM Address
LearnMQSI
PostPosted: Mon Oct 28, 2002 1:16 pm    Post subject: Multiple MQGET Reply with quote

Centurion

Joined: 20 Aug 2002
Posts: 137

Hi bower,

Here is the code. I appreciate your help. Thanx in advance
Of course, the QUEUE_EMPTY is defined and initialized to FALSE before the LOOP.

NOTE:
1. Within the loop, I'm opening the Reply Queue only once based on the
record counter value = 1
2. Since its a Trigger type of FIRST, I'm putting messages in the queue
manually.

WHILE NOT QUEUE_EMPTY LOOP
-- Get request contents (in raw format)
v_open_reply_counter := v_open_reply_counter + 1;

mqpack.MQGET
(hConn, hObjRequest, md, gmo, buffer_length, rawbuff,
mlen, CompCode, Reason);
IF CompCode = 2 AND Reason > 0 THEN
v_stmt := 180;
QUEUE_EMPTY := TRUE;
EXIT;
END IF;

-- Convert buffer to CHAR format
v_stmt := 190;
mqpack.RAWtoCHAR(charbuff,1,buffer_length,rawbuff,1);

-- Process charbuff based upon mqcall_type
IF p_mqcall_type = 'XXXXXXX' OR p_mqcall_type = 'YYYYYY' THEN
-- Get appropriate message details
v_stmt := 195;
XXX_Ar_XXXXXX.xx_xxx_xxx
(p_charbuff => charbuff
,p_message_type => p_mqcall_type
,p_stmt_note_ind => p_stmt_note_ind
,p_policy_num => p_pol_num
,p_policy_eff_date => p_pol_eff_date
,p_process_date => p_fin_note_proc_date
,p_sqlerrm => p_sqlerrm_out
,p_sqlcode => p_sqlcode_out
);
-- Convert buffer to RAW format
v_stmt := 200;
mqpack.CHARtoRAW(rawbuff,1,buffer_length,charbuff,1);
-- Put message to Reply Queue
v_stmt := 205;
IF v_open_reply_counter = 1 THEN -- Open Reply Queue only
-- once
odReply.ObjectName := ReplyQName;
O_Options := mqpack.MQOO_OUTPUT +
mqpack.MQOO_FAIL_IF_QUIESCING;
mqpack.MQOPEN(hConn, odReply, O_Options, hObjReply,
CompCode,Reason);
END IF;
mqpack.MQPUT(hConn, hObjReply, md, pmo, buffer_length,
rawbuff, CompCode, Reason);
ELSIF p_mqcall_type = 'XXXXXXX' THEN
Xxx_Xxxxx_Xxxxx.xx_xxxx
(p_charbuff => charbuff,
p_sqlerrm => p_sqlerrm_out,
p_sqlcode => p_sqlcode_out);
v_stmt := 210;
ELSIF p_mqcall_type = 'SYSNOTES' THEN
XXX_Ar_XXX_XXXX.xx_xxxx(
p_charbuff => charbuff,
p_sqlerrm => p_sqlerrm_out,
p_sqlcode => p_sqlcode_out);
END IF;
rawbuff := RPAD('0',20000,'0'); /*Here rawbuffer added, must
initialize */
END LOOP;
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 » General Discussion » Multiple messages with MQGET
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.