Author |
Message
|
Reeti |
Posted: Wed Mar 19, 2003 4:58 am Post subject: [Solved] Clear Messages from a queue |
|
|
Apprentice
Joined: 11 Jul 2002 Posts: 40
|
Hi:
I want to write a program which will do the same work as we do a
clear qlocal(<queuename>) command from runmqsc command. I want to accomplish the same using MqSeries C++ API call. Pls. help.
Best regards
Reeti Saha |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Mar 19, 2003 7:07 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You want to create a PCF message that clears the queue.
Or use the MQAI API to clear the queue.
See the Programmable System Management manual or the Administrative Interface Programming Guide manual for more information. Both are available here http://www-3.ibm.com/software/ts/mqseries/library/manualsa/. |
|
Back to top |
|
 |
bduncan |
Posted: Wed Mar 19, 2003 12:15 pm Post subject: |
|
|
Padawan
Joined: 11 Apr 2001 Posts: 1554 Location: Silicon Valley
|
The other possibility is to use the system command or something similar to actually execute runmqsc from your C program, and directly issuing the clear ql command. I've done this with Perl, and it works very well. Using open2, you can even use input and output buffers to interact with runmqsc and issue subsequent commands based on the result of previous commands. _________________ Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator |
|
Back to top |
|
 |
Reeti |
Posted: Mon Mar 31, 2003 11:51 pm Post subject: |
|
|
Apprentice
Joined: 11 Jul 2002 Posts: 40
|
Hi:
Would u pls send me a sample program doing the same using PCF? It would be of gr8 help.
thanks
Reeti |
|
Back to top |
|
 |
meekings |
Posted: Tue Apr 01, 2003 5:55 am Post subject: |
|
|
 Voyager
Joined: 28 Jun 2001 Posts: 86 Location: UK, South West
|
See the sample program amqsailq.c under <MQ>\tools\c\samples. It uses MQAI to determine the current depth of a queue, but should be readily adaptable. |
|
Back to top |
|
 |
Reeti |
Posted: Wed Apr 02, 2003 2:16 am Post subject: |
|
|
Apprentice
Joined: 11 Jul 2002 Posts: 40
|
hi:
I've tried the programe.. but it's giving the error:
Local queue clear test failed: Completion Code = 2 : Reason = 3008
Error returned by the command server: Completion Code = 2 : Reason = 3020
Pls. help.
follwing is the code snippet to clear the queue:
mqCreateBag(MQCBO_ADMIN_BAG, &responseBag, &compCode, &reason);
mqAddString(adminBag, MQCA_Q_NAME, MQBL_NULL_TERMINATED, "test", &compCode, &reason);
mqAddInteger(adminBag, MQIA_Q_TYPE, MQQT_LOCAL, &compCode, &reason);
mqExecute(hConn, MQCMD_CLEAR_Q, MQHB_NONE, adminBag, responseBag, MQHO_NONE, MQHO_NONE, &compCode, &reason);
regards
Reeti |
|
Back to top |
|
 |
dgolding |
Posted: Wed Apr 02, 2003 4:46 am Post subject: |
|
|
 Yatiri
Joined: 16 May 2001 Posts: 668 Location: Switzerland
|
Use "mqrc" on the command line:
mqrc 3008
3008 0x00000bc0 MQRCCF_COMMAND_FAILED
mqrc 3020
3020 0x00000bcc MQRCCF_PARM_COUNT_TOO_BIG
Too many parameters (arguements)?
Looks like a case for "read the manual"! Although where the MQAI is documented I'm not 100% sure I'm afraid  |
|
Back to top |
|
 |
meekings |
Posted: Wed Apr 02, 2003 5:14 am Post subject: |
|
|
 Voyager
Joined: 28 Jun 2001 Posts: 86 Location: UK, South West
|
Clearing a queue doesn't require you to specify the queue type - it has to be local. Take out the mqAddInteger line. This is documented in the manual. |
|
Back to top |
|
 |
Reeti |
Posted: Thu Apr 03, 2003 5:38 am Post subject: |
|
|
Apprentice
Joined: 11 Jul 2002 Posts: 40
|
|
Back to top |
|
 |
|