Putting messages on the system-command input queue

Use the MQPUT call to put request messages containing commands on the system-command input queue. In this call you specify the name of the reply-to queue that you have already opened.

To use the MQPUT call:

  1. Set these MQPUT parameters:
    Hconn
    The connection handle returned by the MQCONN or MQCONNX call.
    Hobj
    The object handle returned by the MQOPEN call for the system-command input queue.
    BufferLength
    The length of the formatted command.
    Buffer
    The name of the buffer containing the command.
  2. Set these MQMD fields:
    MsgType
    MQMT_REQUEST
    Format
    MQFMT_STRING or MQFMT_NONE

    If you are not using the same code page as the queue manager, set CodedCharSetId as appropriate and set MQFMT_STRING, so that the command server can convert the message. Do not set MQFMT_ADMIN, as that causes your command to be interpreted as PCF.

    ReplyToQ
    Name of your reply-to queue.
    ReplyToQMgr
    If you want replies sent to your local queue manager, leave this field blank. If you want your WebSphere MQ commands to be sent to a remote queue manager, put its name here. You must also have the correct queues and links set up, as described in the WebSphere MQ Intercommunication manual.
  3. Set any other MQMD fields, as required. You should normally use nonpersistent messages for commands.
  4. Set any PutMsgOpts options, as required.

    If you specify MQPMO_SYNCPOINT (the default), you must follow the MQPUT call with a syncpoint call.

Using MQPUT1 and the system-command input queue

If you want to put just one message on the system-command input queue, you can use the MQPUT1 call. This call combines the functions of an MQOPEN, followed by an MQPUT of one message, followed by an MQCLOSE, all in one call. If you use this call, modify the parameters accordingly. See the WebSphere MQ Application Programming Guide for details.