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 IBM MQ Support » Clearing all messages in a queue manager

Post new topic  Reply to topic Goto page Previous  1, 2
 Clearing all messages in a queue manager « View previous topic :: View next topic » 
Author Message
PaulClarke
PostPosted: Tue Mar 31, 2015 9:20 am    Post subject: Reply with quote

Grand Master

Joined: 17 Nov 2005
Posts: 1002
Location: New Zealand

tczielke,

For a simple task such as this I agree that write an OS script is not too arduous although I would argue that it is still much more complicated and difficult to maintain plus it is platform/shell dependant. As one adds more conditions the script could get rather messy. I think you also have a bug in the script. Would it not bypass a queue such as APPLICATION.SYSTEM.DATA ? Although I think the fix is pretty easy.

As for emptying the queue my MA01 (Q) would do it with a command such as q -m QM1 -I MYQ -q and would be happy with any message size.

Cheers,
Paul
_________________
Paul Clarke
MQGem Software
www.mqgem.com
Back to top
View user's profile Send private message Visit poster's website
tczielke
PostPosted: Tue Mar 31, 2015 10:05 am    Post subject: Reply with quote

Guardian

Joined: 08 Jul 2010
Posts: 941
Location: Illinois, USA

PaulClarke wrote:
tczielke,

For a simple task such as this I agree that write an OS script is not too arduous although I would argue that it is still much more complicated and difficult to maintain plus it is platform/shell dependant. As one adds more conditions the script could get rather messy. I think you also have a bug in the script. Would it not bypass a queue such as APPLICATION.SYSTEM.DATA ? Although I think the fix is pretty easy.

As for emptying the queue my MA01 (Q) would do it with a command such as q -m QM1 -I MYQ -q and would be happy with any message size.

Cheers,
Paul


Yes, I agree with everything you said. Also, here is a correction to that script to only exlucde queues that start with SYSTEM.

echo "dis ql(*) where (CURDEPTH GE 1)" | runmqsc QM1 | grep -v "(SYSTEM." | grep "QUEUE(" | cut -d'(' -f2 | cut -d')' -f1 | while read LineTx; do echo amqsget $LineTx QM1;done
_________________
Working with MQ since 2010.
Back to top
View user's profile Send private message
tczielke
PostPosted: Tue Mar 31, 2015 10:22 am    Post subject: Reply with quote

Guardian

Joined: 08 Jul 2010
Posts: 941
Location: Illinois, USA

Vitor wrote:
tczielke wrote:
So I guess if your queues have larger messages, use your MQ getter program of choice.


Or recompile the amqsget sample to a) accept larger messages or b) warn rather than fail if truncating.


Or if you are feeling adventurous and ornery, ZAP the amqsget module and change the GMO options from x'00004005' to x'00004045' to add in the MQGMO_ACCEPT_TRUNCATED_MSG option.

Unfortunately, based on the amsget logic, this only successfully GETs the truncated message, but the program stops processing since it receives a 2079 on the accepted truncated GET.

Of course, the best way to go is to just use a getting application that can handle this appropriately, like the q program that Paul mentioned.
_________________
Working with MQ since 2010.
Back to top
View user's profile Send private message
PaulClarke
PostPosted: Tue Mar 31, 2015 10:27 am    Post subject: Reply with quote

Grand Master

Joined: 17 Nov 2005
Posts: 1002
Location: New Zealand

Actually, at the risk of appearing pedantic, are you sure that grep string is right? The dot '.' character has special meaning in regular expressions doesn't it? Doesn't it match any character. So, wouldn't your grep also exclude queues such as SYSTEMATICS.TEST ?

Cheers,
Paul.
_________________
Paul Clarke
MQGem Software
www.mqgem.com
Back to top
View user's profile Send private message Visit poster's website
tczielke
PostPosted: Tue Mar 31, 2015 10:38 am    Post subject: Reply with quote

Guardian

Joined: 08 Jul 2010
Posts: 941
Location: Illinois, USA

PaulClarke wrote:
Actually, at the risk of appearing pedantic, are you sure that grep string is right? The dot '.' character has special meaning in regular expressions doesn't it? Doesn't it match any character. So, wouldn't your grep also exclude queues such as SYSTEMATICS.TEST ?

Cheers,
Paul.


You are correct! I don't consider myself an expert with scripting, but I think this would work. At least, it picked up your SYSTEMATICS.TEST example.

echo "dis ql(*) where (CURDEPTH GE 1)" | runmqsc | grep -v "(SYSTEM\." | grep "QUEUE(" | cut -d'(' -f2 | cut -d')' -f1 | while read LineTx; do echo amqsget $LineTx;done
_________________
Working with MQ since 2010.
Back to top
View user's profile Send private message
md7
PostPosted: Tue Mar 31, 2015 9:12 pm    Post subject: Reply with quote

Apprentice

Joined: 29 Feb 2012
Posts: 49
Location: Sydney.AU

Thanks for the replies.. I ended up exporting the queue manager, deleting the queue manager and creating it again. btw it was on a Windows OS
Back to top
View user's profile Send private message
PaulClarke
PostPosted: Wed Apr 01, 2015 12:36 am    Post subject: Reply with quote

Grand Master

Joined: 17 Nov 2005
Posts: 1002
Location: New Zealand

In the interests of 'getting the scripts right' it has been pointed out to me that actually my 'clear all queues' script can be simplified still further since MQSCX supports WHERE clauses with multiple expressions. So, the script need only be....
Code:
* Get all of the queues
foreach(DISPLAY QLOCAL(*) CURDEPTH =WHERE(curdepth & queue NL "SYSTEM.*"))
  @queue = QUEUE

  CLEAR QLOCAL(<@queue>)
endfor

Cheers,
Paul.
_________________
Paul Clarke
MQGem Software
www.mqgem.com
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2 Page 2 of 2

MQSeries.net Forum Index » General IBM MQ Support » Clearing all messages in a queue manager
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.