Using a server service object
These examples shows how to define, use, and alter a server service object to start a trigger monitor or other program.
Before you begin
Note: These examples require you to run MQSC commands. How you do this varies by platform. See Administering IBM® MQ using MQSC commands.
These examples are written with
UNIX style path separator characters, except where
otherwise stated.Procedure
More examples of passing arguments
- Define a server service object to start a program called
runservwhen a queue manager is started.Do this using the DEFINE SERVICE MQSC command.
This example is written with Windows style path separator characters.
One of the arguments that is passed to the starting program is a string containing a space. This argument needs to be passed as a single string. To achieve this, double quotation marks are used as shown in the following command to define the command service object.
Where:DEFINE SERVICE(S1) SERVTYPE(SERVER) CONTROL(QMGR) + STARTCMD('C:\Program Files\Tools\runserv.exe') + STARTARG('-m +QMNAME+ -d "C:\Program Files\Tools\"') + STDOUT('C:\Program Files\Tools\+MQ_SERVICE_NAME+.out') DEFINE SERVICE(S4) + CONTROL(QMGR) + SERVTYPE(SERVER) + STARTCMD('C:\Program Files\Tools\runserv.exe') + STARTARG('-m +QMNAME+ -d "C:\Program Files\Tools\"') + STDOUT('C:\Program Files\Tools\+MQ_SERVICE_NAME+.out')-
+QMNAME+is a token representing the name of the queue manager. -
is a string containing a space, which will be passed as a single string.C:\Program Files\Tools\
-
- Define a server service object that can be used to automatically start the Trigger Monitor
when the queue manager starts.
Do this using the DEFINE SERVICE MQSC command.
Where:DEFINE SERVICE(TRIG_MON_START) + CONTROL(QMGR) + SERVTYPE(SERVER) + STARTCMD('runmqtrm') + STARTARG('-m +QMNAME+ -q +IQNAME+')-
+QMNAME+is a token representing the name of the queue manager. -
+IQNAME+is an environment variable defined by the user in one of the service.env files representing the name of the initiation queue.
-