Run WebSphere® 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 defining, altering, or deleting a local queue object. MQSC commands and their syntax are described in the MQSC reference.

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 using the dspmq -o installation command.

To end using the runmqsc command, use the end command. You can also use the exit or the quit command to stoprunmqsc.


Read syntax diagramSkip visual syntax diagramrunmqsc  -e   -v   -w WaitTime -x  -m DefaultQMgrName -m LocalQMgrNameQMgrName


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 on 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.

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.

Optional parameters

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.
Verifies the specified commands without performing the actions. This mode is only available locally. The -w and -x flags are ignored if they are specified at the same time.
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. See Preparing channels and transmission queues for remote administration for more information.
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 999 999 seconds.

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.

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

The target queue manager is running under z/OS®. This flag applies only in indirect mode. The -w flag must also be specified. In indirect mode, the MQSC commands are written in a form suitable for the WebSphere MQ for z/OS command queue.
The name of the target queue manager on which to run the MQSC commands, by default, the default queue manager.

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


  1. Enter this command at the 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\"
    This command verifies the MQSC commands in file The queue manager name is BANK. The output is displayed 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\WebSphere MQ\mqsc\" > 
    	"c:\Program Files\IBM\WebSphere 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