[AIX, Linux, Windows]

Running MQSC commands interactively under runmqsc

On AIX®, Linux®, and Windows, you can use the runmqsc command prompt to issue MQSC commands to a queue manager interactively. Interactive running is particularly suitable for quick tests.

Before you begin

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.

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 using the MQPROMPT environment variable. For more information, see Setting the MQSC command prompt.

[AIX][Linux]When you run MQSC commands interactively on AIX and Linux platforms, the runmqsc command prompt also supports additional command line editor functions. See Enabling command recall and completion, and Emacs command keys, for runmqsc.

About this task

The runmqsc command is used to open a command prompt from which you can issue MQSC commands. These commands and their syntax are described in the MQSC commands reference.

When you start the runmqsc command prompt as described in this task, you set the prompt to run in one of three modes, depending on the flags set on the command:
  • Verification mode, where the MQSC commands are verified on a local queue manager, but are not run.
  • Direct mode, where the MQSC commands are run on a local queue manager.
  • Indirect mode, where the MQSC commands are run on a remote queue manager.

The procedure below sets the prompt to run in direct mode. Other options are illustrated in the examples that follow the main steps.

Procedure

  1. Open a command window or shell and enter the following command:
    runmqsc QMgrName
    
    Where QMgrName specifies the name of the queue manager that you want to process the MQSC commands. You can leave QMgrName blank to process MQSC commands on the default queue manager.
  2. Type in any MQSC commands, as required. For example, to create a local queue called ORANGE.LOCAL.QUEUE enter the following command:
    DEFINE QLOCAL (ORANGE.LOCAL.QUEUE)
    
    For commands that have too many parameters to fit on one line, use continuation characters to indicate that a command is continued on the following line:
    • A minus sign (-) indicates that the command is to be continued from the start of the following line.
    • A plus sign (+) indicates that the command is to be continued from the first non-blank character on the following line.

    Command input terminates with the final character of a non-blank line that is not a continuation character. You can also terminate command input explicitly by entering a semicolon (;).

  3. Stop working with MQSC commands by entering the following command:
    end

    Alternatively, you can use the exit command, the quit command, or the EOF character for your operating system.

Results

When you issue MQSC commands, the queue manager returns operator messages that confirm your actions or tell you about the errors you have made. For example, the following message confirms a queue is created:
AMQ8006: IBM MQ queue created.
The following message indicates that you have made a syntax error:
AMQ8405: Syntax error detected at or near end of command segment below:-
AMQ8426: Valid MQSC commands are:

ALTER
CLEAR
DEFINE
DELETE
DISPLAY
END
PING
REFRESH
RESET
RESOLVE
RESUME
START
STOP
SUSPEND
4 : end

These messages are sent to the standard output device, which by default is the display. If you have not entered the command correctly, refer to the reference information for the command to find the correct syntax. See MQSC commands reference.

Example

The following are variants of the runmqsc QMgrName command that is used in the previous steps. These variants create different configurations of the runmqsc command prompt.
  • The following command uses command filtering to pass a single MQSC command to the MQSC interpreter.
    [Windows]On Windows:
    echo display chstatus(*) | runmqsc QMname
    [Linux]On Linux:
    echo "display chstatus(*)" | runmqsc QMname
  • The following command does not specify a queue manager name, so the MQSC commands are processed on the default queue manager.
    runmqsc
    
  • This command submits commands to the QMREMOTE queue manager, using QMLOCAL to submit the commands.
    runmqsc -w 30 -m QMLOCAL QMREMOTE
    
  • This command verifies that the command syntax is correct on a local queue manager without running the commands. Note that the commands to be verified are read from an input file myprog.in.
    runmqsc -f myprog.in -v QmgrName
    For more information about working with input and output files, see Running MQSC commands from text files under runmqsc.

What to do next

For full details of the runmqsc command syntax, optional parameters and return codes, see runmqsc (run MQSC commands).