Hi, The code is not doing destructive reads.
But your second point led me to the problem. The mqq.CompletionCode was returning warning. The reason was MQRC_TRUNCATED_MSG_FAILED. In this case the browse cursor does not move. By setting the mqgmo.Option to MQGMO_ACCEPT_TRUNCATED_MSG (in addition to Browse of course), I do get all messages on the queue. I had set length to 0 in the get call as I'm not interested in data. All I needed was to present user with list of messages with their Id and other details. Thanks Steve and all others. -----Original Message----- From: GIES, STEVE [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 30, 2002 6:44 PM To: [EMAIL PROTECTED] Subject: Re: ActiveX Object in VB Joshi - Couple of things. First, by not setting the mqgmo.Options = MQGMO_BROWSE_NEXT anymore you are doing destructive gets against your queue not browse gets. Secondly, you are checking the CompletionCode of your mqgmo object. I think you want to check the mqq object. This is the object that will contain the CC from the get method. - Steve -----Original Message----- From: Joshi, A (Anant) [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 30, 2002 12:08 PM To: [EMAIL PROTECTED] Subject: Re: ActiveX Object in VB I was getting MQ Error. MQRC_NO_MSG_AVAILABLE. I modified the code to set the MatchOption. Now I do not get error but only first 3 iterations bring in distinct message IDs. From there, I keep getting third message in an infinite loop. Thanks for help. ======== Code Begin Done = False Set mqmsg = Nothing Set mqgmo = Nothing Set mqmsg = New MQMessage Set mqgmo = New MQGetMessageOptions mqgmo.MatchOptions = MQMO_NONE Do mqq.Get mqmsg, mqgmo, 0 Counter = Counter + 1 If mqgmo.CompletionCode = MQCC_OK Then lstMessages.AddItem Counter & vbTab & mqmsg.MessageId 'lstMessages.AddItem Counter & vbTab & mqmsg.PutDateTime Else Done = True End If mqmsg.MessageId = "" mqgmo.ClearErrorCodes Loop Until Done ========== Code End -----Original Message----- From: Ryan Parmenter [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 30, 2002 3:03 PM To: [EMAIL PROTECTED] Subject: Re: ActiveX Object in VB What error are you getting? Is it a VB error or an MQ error? Ryan >>> [EMAIL PROTECTED] 05/30/02 10:11AM >>> Hi I'm trying to display list of messages with their PutDateTime in a List Box in VB using following code. ======== Code Begin Do If Counter = 0 Then mqgmo.Options = MQGMO_BROWSE_FIRST Else mqgmo.Options = MQGMO_BROWSE_NEXT End If mqq.Get mqmsg, mqgmo, 0 Counter = Counter + 1 If mqgmo.CompletionCode = MQCC_OK Then lstMessages.AddItem Counter & vbTab & mqmsg.PutDateTime Else Done = True End If Loop Until Done ======== Code End However, I get error when loop iterates second time. PutDateTime of first message is read correctly. Any ideas? Thanks in Advance ================================================================== De informatie opgenomen in dit bericht kan vertrouwelijk zijn en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onterecht ontvangt wordt u verzocht de inhoud niet te gebruiken en de afzender direct te informeren door het bericht te retourneren. ================================================================== The information contained in this message may be confidential and is intended to be exclusively for the addressee. Should you receive this message unintentionally, please do not use the contents herein and notify the sender immediately by return e-mail. ================================================================== Instructions for managing your mailing list subscription are provided in the Listserv General Users Guide available at http://www.lsoft.com Archive: http://vm.akh-wien.ac.at/MQSeries.archive ================================================================== De informatie opgenomen in dit bericht kan vertrouwelijk zijn en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onterecht ontvangt wordt u verzocht de inhoud niet te gebruiken en de afzender direct te informeren door het bericht te retourneren. ================================================================== The information contained in this message may be confidential and is intended to be exclusively for the addressee. Should you receive this message unintentionally, please do not use the contents herein and notify the sender immediately by return e-mail. ================================================================== Instructions for managing your mailing list subscription are provided in the Listserv General Users Guide available at http://www.lsoft.com Archive: http://vm.akh-wien.ac.at/MQSeries.archive Instructions for managing your mailing list subscription are provided in the Listserv General Users Guide available at http://www.lsoft.com Archive: http://vm.akh-wien.ac.at/MQSeries.archive ================================================================== De informatie opgenomen in dit bericht kan vertrouwelijk zijn en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onterecht ontvangt wordt u verzocht de inhoud niet te gebruiken en de afzender direct te informeren door het bericht te retourneren. ================================================================== The information contained in this message may be confidential and is intended to be exclusively for the addressee. Should you receive this message unintentionally, please do not use the contents herein and notify the sender immediately by return e-mail. ================================================================== Instructions for managing your mailing list subscription are provided in the Listserv General Users Guide available at http://www.lsoft.com Archive: http://vm.akh-wien.ac.at/MQSeries.archive
