Setting the MQSC command prompt

You can set the MQSC command prompt to a prompt of your choice by using the MQPROMPT environment variable.

Procedure

Set the MQPROMPT environment variable to the prompt of your choice.
The prompt is inserted both when the runmqsc console is run interactively, and when input is redirected into runmqsc from a file or from the standard input device (stdin).

You can include plain text in the command prompt, and you can also insert environment variables by using the +VARNAME+ notation in the same manner as IBM® MQ service object definitions. For more information, see Replaceable inserts on service definitions.

There are a number of other additional replaceable inserts IBM MQ provides, described in the following table.
Replaceable insert Description
MQ_HOST_NAME Host name of the system
MQ_FILE_SEP Platform specific file separator:
  • [AIX][Linux]On AIX® and Linux® systems, the MQ_FILE_SEP is /.
  • [Windows]On Windows systems, the location of the MQ_FILE_SEP is \
MQ_PATH_SEP Platform specific path separator:
  • [AIX][Linux]On AIX and Linux systems, the MQ_PATH_SEP is :.
  • [Windows]On Windows systems, the location of the MQ_PATH_SEP is ;
MQ_DATE_TIME Local system date and time in a fixed YYYY-MM-DD hh:mm:ss.SSS format, for example:
2020-12-25 17:41:37.408
Notes:
  • The MQ replaceable inserts values relate to the IBM MQ installation and host system the runmqsc command is associated with.
  • MQPROMPT is limited to a maximum of 256 characters when inserts are expanded. MQPROMPT expansions over this value result in the entire MQPROMPT string being truncated without the expansions.

For example, to set the prompt to MQSC, enter one of the following commands:

  • [Windows]
    set "MQPROMPT=MQSC"
  • [AIX][Linux]
    export MQPROMPT="MQSC"

Example

The following example shows setting the MQPROMPT variable on an AIX system. The prompt is set to display a username, taken from the associated system environment variable, the queue manager name, and the IBM MQ host name taken from the MQ replaceable inserts:
sh> export MQPROMPT="+USER+ @ +QMNAME+ @ +MQ_HOST_NAME+> "
sh> runmqsc MY.QMGR
5724-H72 (C) Copyright IBM Corp. 1994, 2024.
Starting MQSC for queue manager MY.QMGR.

myuser @ MY.QMGR @ aix1> DISPLAY QMSTATUS
C:\ > set “MQPROMPT=+USERNAME+ @ +QMNAME+ @ +MQ_HOST_NAME+> “
C:\ > runmqsc MY.QMGR
5724-H72 (C) Copyright IBM Corp. 1994, 2024.
Starting MQSC for queue manager MY.QMGR.

myuser @ MY.QMGR @ WIN1> DISPLAY QMSTATUS
The following example adds a timestamp to the MQPROMPT examples above, taken from the MQ replaceable inserts:
sh> export MQPROMPT="+MQ_DATE_TIME+ +USER+ @ +QMNAME+ @ +MQ_HOST_NAME+> "
sh> runmqsc MY.QMGR
5724-H72 (C) Copyright IBM Corp. 1994, 2024.
Starting MQSC for queue manager MY.QMGR.

2020-11-24 18:10:00.404 myuser @ MY.QMGR @ aix1> DISPLAY QMSTATUS
C:\ > set “MQPROMPT=+MQ_DATE_TIME+ +USERNAME+ @ +QMNAME+ @ +MQ_HOST_NAME+> “
C:\ > runmqsc MY.QMGR
5724-H72 (C) Copyright IBM Corp. 1994, 2024.
Starting MQSC for queue manager MY.QMGR.

2020-11-24 18:10:01.007 myuser @ MY.QMGR @ WIN1> DISPLAY QMSTATUS