runmqsc (run MQSC commands)
Run IBM MQ commands on a queue manager.
Purpose
Use the runmqsc command to issue MQSC commands to a queue manager. MQSC commands enable you to perform administration tasks. For example, we can define, alter, or delete a local queue object. MQSC commands and their syntax are described in MQSC commands.
We must use the runmqsc command from the installation associated with the queue manager that we are working with. We can find out which installation a queue manager is associated with by using the dspmq -o installation command.
To stop the runmqsc command, use the end command. We can also use the exit or the quit command.
We can make it easier to see that we are in an MQSC environment and see some details of the current environment by setting a prompt of our choice by using the MQPROMPT environment variable. For more information, see Set the MQSC command prompt.
Syntax
We can use the -n parameter on its own, or we can use a number of other parameters in combination:Description
We can start the runmqsc command in three ways:
- Verify command
- Verify MQSC commands but do not run them. An output report is generated indicating the success or failure of each command. This mode is available on a local queue manager only.
- Run command directly
- Send MQSC commands directly to a local queue manager.
- Run command indirectly
- Run MQSC commands on a remote queue manager. These commands are put on the command queue of a remote queue manager and run in the order in which they were queued. Reports from the commands are returned to the local queue manager.
The runmqsc command takes its input from stdin. When the commands are processed, the results and a summary are put into a report that is sent to stdout.
By taking stdin from the keyboard, we can enter MQSC commands interactively.
Alternatively, we can redirect stdin from a text file. By redirecting the input from a file, we can run a sequence of frequently used commands contained in the file. We can also redirect the output report to a file.Note: If you run runmqsc in client mode by redirecting stdin from a text file, IBM MQ expects the first line of the input file to be a password.Optional parameters
- -c
- Modifies the runmqsc command to connect to a queue manager by using a client
connection. The client channel definitions used to connect to the queue manager are located using
the following environment variables in this order of precedence:
MQSERVER
,
MQCHLLIB
, and
MQCHLTAB
.
This option requires the client to be installed. If it is not installed an error message reporting the missing client libraries is issued.
- -e
- Prevents source text for the MQSC commands from being copied into a report. This parameter is useful when you enter commands interactively.
- -m LocalQMgrName
- The local queue manager that we want to use to submit commands to the remote queue manager. If you omit this parameter the local default queue manager is used to submit commands to the remote queue manager. The -w parameter must also be specified.
- -n
- Modifies the runmqsc command to not connect to a queue manager. If this
parameter is specified, all other command parameters must be omitted, otherwise an error message is
issued.
This option requires the client libraries to be installed. If they are not installed an error message is issued.
MQSC commands entered in this mode are limited to managing the local channel definition file, which is located through the MQCHLLIB and MQCHLTAB environment variables, or the default values if not defined. Note: If you add new entries into the local channel definition file, or alter existing entries, these changes are not reflected inside the queue manager. The queue manager does not read the contents of the local channel definition file. The CCDT file is a write-only file from the perspective of the queue manager. The queue manager does not read the contents of the CCDT file.Only the following MQSC commands are recognized:
For the AUTHINFO management commands, the names of existing AUTHINFO definitions are mapped and addressed using the names CRLLDAPn or OCSP n (according to type), where n is the numeric order in which they appear in the channel definition file. New AUTHINFO definitions are appended to the client channel table in order. For example, the the following commands are issued:
ALTER, DEFINE, DELETE, DISPLAY AUTHINFO (Only of type CRLLDAP or OCSP)
ALTER, DEFINE, DELETE, DISPLAY CHANNEL (Only of type CLNTCONN)
DEFINE AUTHINFO(XYZ) AUTHTYPE(CRLLDAP) CONNAME('xyz') DEFINE AUTHINFO(ABC) AUTHTYPE(CRLLDAP) CONNAME('abc')
This results in the 'xyz' LDAP server being checked for a CRL first, if that CRL server is unavailable then the 'abc' server is checked. Using the DISPLAY AUTHINFO(*) CONNAME command shows this:AMQ8566: Display authentication information details. AUTHINFO(CRLLDAP1) AUTHTYPE(CRLLDAP) CONNAME(xyz) AMQ8566: Display authentication information details. AUTHINFO(CRLLDAP2) AUTHTYPE(CRLLDAP) CONNAME(abc)
Note: The client mode only supports inserting new entries at the end of the client channel table. If we want to change the order of precedence of the CRL LDAP servers, we must remove the existing objects from the list and reinsert them in the correct order at the end. - -u UserID
- If we use the -u parameter to supply a user ID, we are prompted for a
matching password.
If we have configured the CONNAUTH AUTHINFO record with CHCKLOCL(REQUIRED) or CHCKLOCL(REQDADM), we must use the -u parameter otherwise we will not be able to administer your queue manager with runmqsc.
If you specify this parameter and redirect stdin, a prompt will not be displayed and the first line of redirected input should contain the password.
- -v
- Verifies the specified commands without performing the actions. This mode is only available
locally. The -w and -x parameters are ignored if they are
specified at the same time as -v. Important: The
-v flag checks the syntax of the command only. Setting the flag does not check
if any objects mentioned in the command actually exist.
For example, if the queue Q1 does not exist in the queue manager, the following command is syntactically correct and does not generate any syntax errors: runmqsc -v Qmgr display ql(Q1).
However, if you omit the -v flag, you receive error message AMQ8147.
- -w WaitTime
- Run the MQSC commands on another queue manager. We must have the required channel and
transmission queues set up for this. For more information, see Configure queue managers for remote
administration.
This parameter is ignored if the -v parameter is specified.
- WaitTime
- The time, in seconds, that runmqsc waits for replies. Any replies received
after this are discarded, but the MQSC commands still run. Specify a time in the range 1 through
999999.
Each command is sent as an Escape PCF to the command queue (SYSTEM.ADMIN.COMMAND.QUEUE) of the target queue manager.
The replies are received on queue SYSTEM.MQSC.REPLY.QUEUE and the outcome is added to the report. This can be defined as either a local queue or a model queue.
- -x
- The target queue manager is running under z/OS . This parameter applies only in indirect mode. The -w parameter must also be specified. In indirect mode, the MQSC commands are written in a form suitable for the IBM MQ for z/OS command queue.
- QMgrName
- The name of the target queue manager on which to run the MQSC commands. If not specified, the default queue manager is used.
- -f filename
- Read input to be processed from the supplied filename rather than standard input.
Return codes
Return code | Description |
---|---|
00 | MQSC command file processed successfully |
10 | MQSC command file processed with errors; report contains reasons for failing commands |
20 | Error; MQSC command file not run |
Examples
- Enter this command at a command prompt:
runmqsc
Now we can enter MQSC commands directly at the command prompt. No queue manager name is specified, so the MQSC commands are processed on the default queue manager. - Use one of these commands, as appropriate in the environment, to specify that MQSC commands are to be verified only:
runmqsc -v BANK < "/u/users/commfile.in" runmqsc -v BANK < "c:\users\commfile.in"
The queue manager name is BANK. The command verifies the MQSC commands in file commfile.in and displays the output in the current window. - These commands run the MQSC command file mqscfile.in against the default queue manager.
runmqsc < "/var/mqm/mqsc/mqscfile.in" > "/var/mqm/mqsc/mqscfile.out" runmqsc < "C:\Program Files\IBM\MQ\mqsc\mqscfile.in" > "C:\Program Files\IBM\MQ\mqsc\mqscfile.out"
In this example, the output is directed to file mqscfile.out. - This command submits commands to the QMREMOTE queue manager, using QMLOCAL to submit the commands.
runmqsc -w 30 -m QMLOCAL QMREMOTE
Related reference
Related information
- Administration using MQSC commands
- Backing up queue manager configuration
- Restoring queue manager configuration