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 » IBM MQ API Support » [Solved] Clear Messages from a queue

Post new topic  Reply to topic
 [Solved] Clear Messages from a queue « View previous topic :: View next topic » 
Author Message
Reeti
PostPosted: Wed Mar 19, 2003 4:58 am    Post subject: [Solved] Clear Messages from a queue Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Wed Mar 19, 2003 7:07 am    Post subject: Reply with quote

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
View user's profile Send private message
bduncan
PostPosted: Wed Mar 19, 2003 12:15 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address
Reeti
PostPosted: Mon Mar 31, 2003 11:51 pm    Post subject: Reply with quote

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
View user's profile Send private message
meekings
PostPosted: Tue Apr 01, 2003 5:55 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Reeti
PostPosted: Wed Apr 02, 2003 2:16 am    Post subject: Reply with quote

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
View user's profile Send private message
dgolding
PostPosted: Wed Apr 02, 2003 4:46 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
meekings
PostPosted: Wed Apr 02, 2003 5:14 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Reeti
PostPosted: Thu Apr 03, 2003 5:38 am    Post subject: Reply with quote

Apprentice

Joined: 11 Jul 2002
Posts: 40

thanks. it worked.

regds
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 » IBM MQ API Support » [Solved] Clear Messages from a queue
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.