Author |
Message
|
jeevan |
Posted: Sun Sep 17, 2006 7:18 am Post subject: DOS script to automate mqgr management |
|
|
Grand Master
Joined: 12 Nov 2005 Posts: 1432
|
Now I am working on windows Mq. I am trying to convert (rewrite) the unix scripts but having trouble.
First question cat it be achived the same level of automation of qmgr management in windows based mq as unix (aix) based mq?
When I tried a simple unix script to DOS, it did not work. Can you some one tell me what mistake I am making.
the script is to delete all the queue manager.
FOR %%QMGR IN (DSPMQ) DO dltmqm %%QMGR
what is wrong with it? i looked this syntax of for in dos help and tried a few times.
thanks in advance |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Sep 17, 2006 7:29 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
I don't believe your DSPMQ variable has been correctly assigned/initialized. You could put a few echo statements in there as debugging help.
I would try
Code: |
dspmq | "set DSPMQ=" |
but then I am no Dos scripting guru either so take it with a lot of salt... _________________ MQ & Broker admin |
|
Back to top |
|
 |
jeevan |
Posted: Sun Sep 17, 2006 7:49 am Post subject: |
|
|
Grand Master
Joined: 12 Nov 2005 Posts: 1432
|
thanks anyway. Is there any windows mq gurus?
I am not trying to do this for fun. I have mq 6 installed. I have to intalla mq 5.3 for some reason. When I did that I realied that the previous qmgrs ( created in mq6) did not work. Also I do not need them. there are lot of them. So, instead of deleting one by one, thought to write a script equivalent of unix:
for qmgr in dspmq; do
dltmqm $qmgr
done
as simple as this. But I would not be able to do this. the syntax for FOR in dos as follows:
DO %%VAR IN (SET) DO COMMAND COMMAND PARAMETER
but I could not get it working.
thanks |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Sep 17, 2006 2:50 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Did you think about doing something like this:
dspmq > myfile
For %% QMGR IN myfile ....
or for %% QMGR in file myfile.... or however DOS scripting describes it...? _________________ MQ & Broker admin |
|
Back to top |
|
 |
wschutz |
Posted: Sun Sep 17, 2006 3:56 pm Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
|
Back to top |
|
 |
jeevan |
Posted: Sun Sep 17, 2006 4:34 pm Post subject: |
|
|
Grand Master
Joined: 12 Nov 2005 Posts: 1432
|
Thank you for leading me toward the solution. The following script did the job
FOR /F "tokens=2 delims=(, " %%i in (t.txt) do @echo %%i >>t1
FOR /F "tokens=1 delims=), " %%i in (t1) do @echo %%i >>t2
FOR /F "tokens=1 delims=, " %%i in (t2) do dltmqm %%i
Thanks once again, |
|
Back to top |
|
 |
jeevan |
Posted: Sun Sep 17, 2006 4:36 pm Post subject: |
|
|
Grand Master
Joined: 12 Nov 2005 Posts: 1432
|
Sorry t.txt is the output of dspmq |
|
Back to top |
|
 |
jeevan |
Posted: Sun Sep 17, 2006 4:52 pm Post subject: |
|
|
Grand Master
Joined: 12 Nov 2005 Posts: 1432
|
Thank you Wayne. The link is very much usefull. |
|
Back to top |
|
 |
JasonE |
Posted: Mon Sep 18, 2006 1:31 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
How about
for /F "usebackq delims==() tokens=2" %%i in (`dspmq`) do dltmqm %%i
Dos batch language rules ok  |
|
Back to top |
|
 |
jeevan |
Posted: Mon Sep 18, 2006 2:31 am Post subject: |
|
|
Grand Master
Joined: 12 Nov 2005 Posts: 1432
|
Hi JasonE,
It worked perfectly. I read about usebackq delim but did not think exaclty how it works. Thanks a lot. |
|
Back to top |
|
 |
Michael Dag |
Posted: Mon Sep 18, 2006 3:03 am Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
|
Back to top |
|
 |
jeevan |
Posted: Mon Sep 18, 2006 3:33 am Post subject: |
|
|
Grand Master
Joined: 12 Nov 2005 Posts: 1432
|
I searched this forum I dunno how I missed that. Anyway, thanks again bringing this useful stuff to notice.
You all are great |
|
Back to top |
|
 |
|