Author |
Message
|
deeps1281 |
Posted: Mon Mar 13, 2006 5:44 am Post subject: Deleting queues |
|
|
Apprentice
Joined: 31 Aug 2005 Posts: 29
|
Hi
I need to write a sample application which will allow me to delete some of the temperory queues that are created everyday in our testing environment.The number of queues is too large to be deleted manually.
I was suggested PCF messages but i could not find a suitable reference on which i could work further.
I was able to access all the queue names using
PCFMessageAgent agent = new PCFMessageAgent(qMgrIP, qMgrPort, qMgrChannel);
PCFMessage request = new PCFMessage(1;
request.addParameter(2016, "*");
request.addParameter(20, 1001);
PCFMessage responses[] = agent.send(request);
qNames = (String[])responses[0].getParameterValue(3011);
Though i still have no idea how that happened.
Could some one build on it and let me know how i can delete the accessed fields.
Thanks |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Mar 13, 2006 5:57 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
That's a horrible example. I can see why it has confused you.
Go back and download the MS0B support pack again - it's the Java classes for PCF that are being used by your sample code there.
In that distribution is a set of sample code, that includes one that will list the queue names - so it will be the same function as the one you already have - but it will a) use the MQ Constansts by name instead of directly so it will be easier to understand and b) be much better documented.
Then, once you understand how the ListQueues code works, you can start work on your "delete queues" script.
The only thing that will be really different about your script is the PCF command you send and the response you get. The command you need to send is fully described in the Programmable Commands Format manual
http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzac.doc/csqzac04.htm _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
wschutz |
Posted: Mon Mar 13, 2006 9:29 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Wouldn't it be a LOT easier just to write a simple shell script to do this... I assume you know the names of the queues by some pattern that you could grep out ..... if its windows, a kit for doing grep awk sed was previously posted.....[/code] _________________ -wayne |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Mar 13, 2006 10:58 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
wschutz wrote: |
Wouldn't it be a LOT easier just to write a simple shell script to do this... |
Only if deeps1281 knows shell script and grep and awk and ...
If deeps1281 only knows Java, then using MS0B is going to be a lot easier. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
wschutz |
Posted: Mon Mar 13, 2006 11:23 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
easy:
Code: |
echo "dis ql(*)" | runmqsc | egrep "QUEUE\(TEST.*\) *TYPE\(QLOCAL\)" | awk '{print $1}' | sed -e "s/QUEUE(\(.*\))/DELETE QLOCAL\(\1\)/" | runmqsc
|
deletes all local queues that start with TEST* _________________ -wayne |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Mar 13, 2006 4:52 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Guys,
I believe the more important issue here is WHY is his environment burdened with temporary queues that did not get deleted at the end of the day.
Could it be that his applications are creating permanent temporary queues ?
Something need to be done as well to stop the problem from happening not just treat the symptom...
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Mar 13, 2006 5:00 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
FJ -
deeps1281 said "testing environment".
I assumed that these were queues that were being manually created by a development group of some sort, and not being reused at a later point nor manually cleaned up. And that deeps1281 wanted some sort of a quick "delete this list of queues" tool.
Otherwise, yeah. Permanent dynamic queues are probably not what's wanted. And deleting temporary dynamic queues out from under a running application may not be a good idea. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
LearnMQSI |
Posted: Fri Apr 07, 2006 8:22 am Post subject: |
|
|
 Centurion
Joined: 20 Aug 2002 Posts: 137
|
Hi wschutz,
I tried your script and this is what output I get it.
*******************
Starting MQSC for queue manager EIDC.
No MQSC commands read.
No commands have a syntax error.
All valid MQSC commands were processed.
*******************
But, the queues that I was trying to delete, they did not get deleted.
I put your script in a file and I just ran that file by simply typing the file name on the promp on AIX box. Did I ran it correctly????
Thank you _________________ IBM Certified System Administrator - WebSphere MQ 5.3 |
|
Back to top |
|
 |
wschutz |
Posted: Fri Apr 07, 2006 8:29 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Try it without the last runmqsc:
Code: |
echo "dis ql(*)" | runmqsc | egrep "QUEUE\(TEST.*\) *TYPE\(QLOCAL\)" | awk '{print $1}' | sed -e "s/QUEUE(\(.*\))/DELETE QLOCAL\(\1\)/" |
You should get something like:
Quote: |
[wschutz@wschutz ~]$ echo "dis ql(*)" | runmqsc TEST | egrep "QUEUE\(TEST.*\) *TYPE\(QLOCAL\)" | awk '{print $1}' | sed -e "s/QUEUE(\(.*\))/DELETE QLOCAL\(\1\)/"
DELETE QLOCAL(TEST)
DELETE QLOCAL(TEST1)
[wschutz@wschutz ~]$
|
if your not using the default qmgr, you need to provide it on the runmqsc command..... _________________ -wayne |
|
Back to top |
|
 |
|