I was reading the MQ Knowledge Center today (surprising, yes, I know!) looking up whether or not runmqsc in client mode uses regular PCF commands when sending commands to a remote queue manager. It doesn’t. It uses escaped PCF messages.
Anyway, I stumped across an interesting new feature that IBM included in IBM MQ v8.0 which I didn’t know about. You can now set a prompt for runmqsc. The normal prompt for runmqsc is a blank line. It is fine but not very useful if you get distracted then come back later, you may not remember what queue manager and/or server you were connected to.
There are a couple of problems with IBM’s documentation on MQPROMPT:
- On Windows, when you issue the SET command with ” (double quotes) wrapping only the value (right-side of equals sign) then the runmqsc will have those double quotes in its prompt
- On Unix/Linux, the UserId is retrieve with the variable +USER+ but on Windows, the UserId is retrieve with the variable +USERNAME+
- On Windows, if you want a redirection character (i.e. > or & or < ) then you need to wrap the entire command including environment variable name in double quotes. If you only put the command (right-side of equals sign) in double quotes then the double quotes will show up in the runmqsc prompt.
Example on Linux/Unix:
export MQPROMPT="+QMNAME+ > "
Then when you run runmqsc, your runmqsc prompt will look like:
mqm@linux123:~> runmqsc MQLX01 5724-H72 (C) Copyright IBM Corp. 1994, 2018. Starting MQSC for queue manager MQLX01. MQLX01 >
Example on Windows:
set "MQPROMPT=+QMNAME+ > "
Note: Please note where the ” double quotes are located. It is important!!
Then when you run runmqsc, your runmqsc prompt will look like:
C:\Users\roger>runmqsc MQWT1 5724-H72 (C) Copyright IBM Corp. 1994, 2020. Starting MQSC for queue manager MQWT1. MQWT1 >
Or maybe you want it similar to a prompt on server.
On Linux/Unix, you would do:
export MQPROMPT="[+USERNAME+@+MQ_HOST_NAME+] +QMNAME+ > "
Then when you run runmqsc, your runmqsc prompt will look like:
mqm@linux123:~> runmqsc MQLX01 5724-H72 (C) Copyright IBM Corp. 1994, 2018. Starting MQSC for queue manager MQLX01. [mqm@linux123] MQLX01 >
And on Windows, you would do:
set "MQPROMPT=[+USERNAME+@+MQ_HOST_NAME+] +QMNAME+ > "
Then when you run runmqsc, your runmqsc prompt will look like:
C:\Users\roger>runmqsc MQWT1 5724-H72 (C) Copyright IBM Corp. 1994, 2020. Starting MQSC for queue manager MQWT1. [roger@windows123] MQWT1 >
Or maybe you want the UserId and queue manager name but with a “$” rather than a “>”.
On Linux/Unix, you would do:
export MQPROMPT="+USER+ @ +QMNAME+ $ "
Then when you run runmqsc, your runmqsc prompt will look like:
mqm@linux123:~> runmqsc MQLX01 5724-H72 (C) Copyright IBM Corp. 1994, 2018. Starting MQSC for queue manager MQLX01. mqm @ MQLX01 $
And on Windows, you would do:
set “MQPROMPT=+USERNAME+ @ +QMNAME+ $ “
Then when you run runmqsc, your runmqsc prompt will look like:
C:\Users\roger>runmqsc MQWT1 5724-H72 (C) Copyright IBM Corp. 1994, 2020. Starting MQSC for queue manager MQWT1. roger @ MQWT1 $
Or maybe you log onto the remote server with PuTTY or similar xterm terminal emulation and you want a token to let you know which environment you are in (i.e. DEV, QA, PROD, etc).
Example on Linux/Unix:
export MQPROMPT="[PROD] +USER+ @ +QMNAME+ > "
Then when you run runmqsc, your runmqsc prompt will look like:
mqm@linux123:~> runmqsc MQLX01 5724-H72 (C) Copyright IBM Corp. 1994, 2018. Starting MQSC for queue manager MQLX01. [PROD] mqm @ MQLX01 >
Example on Windows:
set “MQPROMPT=[PROD] +USERNAME+ @ +QMNAME+ > “
Then when you run runmqsc, your runmqsc prompt will look like:
C:\Users\roger>runmqsc MQWT1 5724-H72 (C) Copyright IBM Corp. 1994, 2020. Starting MQSC for queue manager MQWT1. [PROD] roger @ MQWT1 >
I tried setting the color for MQPROMPT like PROMPT on Windows and PS1 on Linux but it appears that runmqsc does not support it.
Note: Rather than setting the MQPROMPT each time you are using runmqsc, simply set the command in your profile on Linux/Unix or in the Environment Variables panel on Windows.
Regards,
Roger Lacroix
Capitalware Inc.