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 » Passing or setting Variables when using runmqsc scripts

Post new topic  Reply to topic
 Passing or setting Variables when using runmqsc scripts « View previous topic :: View next topic » 
Author Message
Ramphart
PostPosted: Mon Feb 14, 2005 2:43 am    Post subject: Passing or setting Variables when using runmqsc scripts Reply with quote

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
View user's profile Send private message
romudd
PostPosted: Mon Feb 14, 2005 5:46 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Tibor
PostPosted: Mon Feb 14, 2005 6:22 am    Post subject: Reply with quote

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
View user's profile Send private message
Ramphart
PostPosted: Mon Feb 21, 2005 3:22 am    Post subject: Reply with quote

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
View user's profile Send private message
Michael Dag
PostPosted: Mon Feb 21, 2005 3:44 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » Passing or setting Variables when using runmqsc scripts
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.