Hi,
Actually, Peter and I have been having a long discussion about it over at mqseries.net . http://www.mqseries.net/phpBB2/viewtopic.php?p=67451#67451
Here's a summary of what I have discovered. Please note the difference between 'Destructive Get' and 'Destructive Get message under cursor'.
Here's the layout without a loop structure. Assume 10 messages in the queue for each test scenario.
Scenario #1:
Open Queue Browse First - returns #1 Browse Next - returns #2 Browse Next - returns #3 Browse Next - returns #4 Browse Next - returns #5 Browse Next - returns #6 Destructive Get message under cursor - - returns #6 Browse Next - returns #7 Browse Next - returns #8 Browse Next - returns #9 Browse Next - returns #10 Browse Next - returns 2033 - no more messages Close Queue
Scenario #2:
Open Queue Browse First - returns #1 Browse Next - returns #2 Browse Next - returns #3 Browse Next - returns #4 Browse Next - returns #5 Browse Next - returns #6 Destructive Get message under cursor - - returns #6 Destructive Get - returns #1 Destructive Get - returns #2 Destructive Get - returns #3 Destructive Get - returns #4 Destructive Get - returns #5 Destructive Get - returns 6th message in queue originally #7 Destructive Get - returns 7th message in queue originally #8 Destructive Get - returns 8th message in queue originally #9 Destructive Get - returns 9th message in queue originally #10 Destructive Get - returns 2033 - no more messages Close Queue
If I don't stop it after a particular number of messages then the above happens (i.e. only destructively get 5 messages).
Scenario #3:
Open Queue Browse First - returns #1 Browse Next - returns #2 Browse Next - returns #3 Browse Next - returns #4 Browse Next - returns #5 Browse Next - returns #6 Destructive Get message under cursor - - returns #6 Browse Next - returns #7 Destructive Get - returns #1 Browse Next - returns #8 Destructive Get - returns #2 Browse Next - returns #9 Destructive Get - returns #3 Browse Next - returns #10 Destructive Get - returns #4 Browse Next - returns 2033 - no more messages
It's kinda cool that the cursors are truly independent of one another but it lends me back to my original question: How do you move the destructive get cursor?
Regards, Roger Lacroix
At 11:23 AM 7/31/2004, you wrote:
Roger, On test #2 is this the sequence: Browse_First (#1) Browse_Next (#2) Browse_Next (#3) Browse_Next (#4) Browse_Next (#5) Browse_Next (#6) Get_Under_Cursor (#6) Get_Under_Cursor (#?) etc.....
OR Browse_First (#1) Browse_Next (#2) Browse_Next (#3) Browse_Next (#4) Browse_Next (#5) Browse_Next (#6) Get_Under_Cursor (#6) Browse_Next (#7 one would assume) Get_Under_Cursor (#?) Browse_Next (#8 one would assume) etc.....
Regardless
I know the book sez that the Get_Msg_Under_Cursor will remove the last message gotten with a Browse_Msg_First or Browse_Msg_Next.
So I will stick out my neck and assume that you just deleted the message pointed to by the Broswe_Next and the only pointer left pointing to a valid message is Browse_First and thus when you delete that one the cursor is moved to the next valid first message in the queue.
bobbee
From: Roger Lacroix <[EMAIL PROTECTED]> Reply-To: MQSeries List <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: Message under cursor Date: Fri, 30 Jul 2004 18:04:03 -0400
All,
I was doing some testing of MQ code and have a question.
First the testing:
Test #1: I created a program to browse messages until a particular message then do a destructive get of it. I put 10 messages in the queue and had the program destructively get message number 6. This worked fine and the queue had 9 messages left the original message # 6 was removed.
I cleared the queue before the next test.
Test #2: I created a program to browse to message a particular message then do a destructive get of it and all remaining messages. I put 10 messages in the queue and had the program destructively get message number 6 and the remaining messages (7,8,9&10). This worked and but I did not get the results I was expecting. It should have removed the 5 messages starting at messages # 6 (i.e. 6,7,8,9&10). It removed 5 messages but they were message # 6,1,2,3&4. The message # 5,7,8,9&10 were left on the queue.
I did several tests and concluded the following: When the program does a destructive get for a 'message under cursor', it does not actually move the destructive get cursor.
For those who do not know, when an application reads a message there are 2 cursors that keep track of where you are while getting messages. There is a Browse Cursor and a Destructive Read Cursor. They are independent of each other.
I thought that when an application does a 'destructive get under cursor' (MQGMO_MSG_UNDER_CURSOR) that the destructive get cursor was moved to the current message position but that does not appear to be true. It remains at its previous position.
I.e. In my example, even though my app. did a 'destructive get under cursor' for message number 6, the destructive get cursor was still pointing to the first message in the queue.
So, to the question: How do you move the destructive get cursor without deleting messages? I have gone through the GetMessageOptions and I don't see anything.
It appears that once you starting browsing beyond the first message, you are stuck with doing the 'destructive get under cursor' for removing messages. (Because the 'destructive get under cursor' is still pointing at the first message. )
So, if this is not the solution, then what is a better one?
Regards, Roger Lacroix Capitalware Inc. http://www.capitalware.biz
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
_________________________________________________________________ Don t just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/
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