runmqsc (run MQSC commands)

Run IBM® MQ commands on a queue manager.


Use the runmqsc command to issue MQSC commands to a queue manager. MQSC commands enable you to perform administration tasks. For example, you can define, alter, or delete a local queue object. MQSC commands and their syntax are described in MQSC commands.

You must use the runmqsc command from the installation associated with the queue manager that you are working with. You 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. You can also use the exit or the quit command.

You can make it easier to see that you are in an MQSC environment and see some details of the current environment by setting a prompt of your choice by using the MQPROMPT environment variable. For more information, see Setting the MQSC command prompt.


You can use the -n parameter on its own, or you can use a number of other parameters in combination:

Read syntax diagramSkip visual syntax diagram runmqsc  -n

Read syntax diagramSkip visual syntax diagram runmqsc  -e  -v  -c  -u UserID  -w WaitTime -x -mDefaultQMgrName-mLocalQMgrNameQMgrName-ffilename


You 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, you can enter MQSC commands interactively.

Alternatively, you can redirect stdin from a text file. By redirecting the input from a file, you can run a sequence of frequently used commands contained in the file. You 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

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.

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 you 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.
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:


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.
AMQ8566: Display authentication information details.
Note: The client mode only supports inserting new entries at the end of the client channel table. If you want to change the order of precedence of the CRL LDAP servers, you must remove the existing objects from the list and reinsert them in the correct order at the end.
-u UserID
If you use the -u parameter to supply a user ID, you are prompted for a matching password.

If you have configured the CONNAUTH AUTHINFO record with CHCKLOCL(REQUIRED) or CHCKLOCL(REQDADM), you must use the -u parameter otherwise you 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.

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. You must have the required channel and transmission queues set up for this. For more information, see Configuring queue managers for remote administration.

This parameter is ignored if the -v parameter is specified.

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.

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.
The name of the target queue manager on which to run the MQSC commands. If not specified, the default queue manager is used.
[V9.1.4 Dec 2019][UNIX, Linux, Windows, IBM i]-f filename
Read input to be processed from the supplied filename rather than standard input.

Return codes

Table 1. Return code identifiers and descriptions
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


  1. Enter this command at a command prompt:
    Now you 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.
  2. Use one of these commands, as appropriate in your environment, to specify that MQSC commands are to be verified only:
    runmqsc -v BANK < "/u/users/"
    runmqsc -v BANK < "c:\users\"
    The queue manager name is BANK. The command verifies the MQSC commands in file and displays the output in the current window.
  3. These commands run the MQSC command file against the default queue manager.
    runmqsc < "/var/mqm/mqsc/" > "/var/mqm/mqsc/mqscfile.out"
    runmqsc < "C:\Program Files\IBM\MQ\mqsc\" >
            "C:\Program Files\IBM\MQ\mqsc\mqscfile.out"
    In this example, the output is directed to file mqscfile.out.
  4. This command submits commands to the QMREMOTE queue manager, using QMLOCAL to submit the commands.
    runmqsc -w 30 -m QMLOCAL QMREMOTE