Author |
Message
|
Ramphart |
Posted: Mon Feb 14, 2005 2:43 am Post subject: Passing or setting Variables when using runmqsc scripts |
|
|
 Disciple
Joined: 21 Jul 2004 Posts: 150 Location: South Africa, JHB
|
Is it possible to define variables in a script file for use with runmqsc?
I'm running the scripts from Windows Platform
-My current method
DEFINE QR(JOURNAL.ENTRY.QR) +
RNAME(JOURNAL.ENTRY.QL) +
RQMNAME(RM.QMGR1) +
XMITQ(RM.QMGR1) +
DEFPSIST(YES) +
REPLACE
-What I'd like to do:
VarA = RM.QMGR1
VarB = RM.QMGR1
DEFINE QR(JOURNAL.ENTRY.QR) +
RNAME(JOURNAL.ENTRY.QL) +
RQMNAME(VarA) +
XMITQ(VarB) +
DEFPSIST(YES) +
REPLACE
OR
DEFINE QR(JOURNAL.ENTRY.QR) +
RNAME(JOURNAL.ENTRY.QL) +
RQMNAME(%1) +
XMITQ(%2) +
DEFPSIST(YES) +
REPLACE
where %1 and %2 are populated from the command prompt when running runmqsc.
The reason being that I want to run the same script against my DEVELOPMENT and PRODUCTION environments and merely pass the correct Qmanager names, Transmit Q names etc. when using runmqsc. _________________ Applications Architect
Last edited by Ramphart on Mon Feb 14, 2005 6:03 am; edited 1 time in total |
|
Back to top |
|
 |
romudd |
Posted: Mon Feb 14, 2005 5:46 am Post subject: |
|
|
Apprentice
Joined: 12 Aug 2003 Posts: 31 Location: Sao Paulo - Brazil
|
You didn't mention your operating system...
It is possible, these are sample-scripts using Unix and DOS shells.
I don't know if you can do this using pure MQSC.
Quote: |
set VarA=RM.QMGR1
set VarB=RM.QMGR1
runmqsc MY.QM <<END
DEFINE QR(JOURNAL.ENTRY.QR) +
RNAME(JOURNAL.ENTRY.QL) +
RQMNAME($VarA) +
XMITQ($VarB) +
DEFPSIST(YES) +
REPLACE
END |
Quote: |
set VarA=RM.QMGR1
set VarB=RM.QMGR1
echo DEFINE QR(JOURNAL.ENTRY.QR) + > temporary.txt
echo RNAME(JOURNAL.ENTRY.QL) + >> temporary.txt
echo RQMNAME(%VarA%) + >> temporary.txt
echo XMITQ(%VarB%) + >> temporary.txt
echo DEFPSIST(YES) + >> temporary.txt
echo REPLACE >> temporary.txt
runmqsc MY.QM < temporary.txt |
|
|
Back to top |
|
 |
Tibor |
Posted: Mon Feb 14, 2005 6:22 am Post subject: |
|
|
 Grand Master
Joined: 20 May 2001 Posts: 1033 Location: Hungary
|
Try something similar:
Code: |
C:\>set VarA=SYSTEM.*
C:\>echo dis ql(%VarA%) curdepth | runmqsc CMDEV
5724-B41 (C) Copyright IBM Corp. 1994, 2002. ALL RIGHTS RESERVED.
Starting MQSC for queue manager CMDEV.
1 : dis ql(SYS*) curdepth
AMQ8409: Display Queue details.
QUEUE(SYSTEM.ADMIN.CHANNEL.EVENT) CURDEPTH(0)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.ADMIN.COMMAND.QUEUE) CURDEPTH(0)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.ADMIN.PERFM.EVENT) CURDEPTH(0)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.ADMIN.QMGR.EVENT) CURDEPTH(1)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.AUTH.DATA.QUEUE) CURDEPTH(38)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.BROKER.ADMIN.REPLY) CURDEPTH(0)
AMQ8409: Display Queue details.
....
|
Tibor
PS: I wasn't fast enough  |
|
Back to top |
|
 |
Ramphart |
Posted: Mon Feb 21, 2005 3:22 am Post subject: |
|
|
 Disciple
Joined: 21 Jul 2004 Posts: 150 Location: South Africa, JHB
|
Tibor wrote: |
[code]C:\>echo dis ql(%VarA%) curdepth | runmqsc CMDEV |
Thx guys. Tibor - I like what you did here but I don't understand how the combination of ECHO, |, RUNMQSC statements execute to achieve the output. Can you talk me thru it pls. Maybe I'm just stupid, but it's kinda facinating.  _________________ Applications Architect |
|
Back to top |
|
 |
Michael Dag |
Posted: Mon Feb 21, 2005 3:44 am Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
the echo part is what the os does.
so echo dis ql(%VarA%) curdepth
results in dis ql(SYSTEM.*) curdepth
the | pipes this command to runmqsc with queuemanager CMDEV _________________ Michael
MQSystems Facebook page |
|
Back to top |
|
 |
|