IBM Support

"dspmq -n" can be used to force the value of STATUS to be displayed in English, regardless of the language of the locale

Question & Answer


Question

Is there a way to always show the STATUS information of the WebSphere MQ command, dspmq, in English, even when the locale is not English? Your company has several hosts with Queue Managers in different countries and in each host the locale of the "mqm" user has been customized for other several languages, including English. You were asked to create a script to monitor the status of the queue managers (using the MQ command "dspmq") and you want to capture the status information and proceed to perform an action based on the value of the status. However, you notice that the status information has been internationalized. For example: English: STATUS(Running) Spanish: STATUS(En ejecución) You do not want to complicate the script by having "if" or "switch" statements for each language, because it is going to be difficult to test and whenever there is a new language, the script would need to be modified.

Cause

This scenario is run on a test Linux host that has MQ 7.0.1 and the default language is for English.
The MQ file set for the message catalog for Spanish has been installed:
rpm -ivh MQSeriesMsg_es-7.0.1-0.i386.rpm

After login, verify the default language (specified by the environment variable LANG) and locale.
Note that the output of "locale" is rather long, thus, to keep this technote short, only certain lines are shown from the output.

$ echo $LANG
en_US.UTF-8

$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
...
LC_MESSAGES="en_US.UTF-8"

Display the MQ status. Notice that the STATUS is shown in English, which is the language used for the locale for this user.

$ dspmq
QMNAME(QM_1) STATUS(Running)
QMNAME(QM_2) STATUS(Ended normally)

Now, let's change the LANG to the Spanish locale:

$ export LANG=es_ES

Verify the language and locale:

$ echo $LANG
LANG=es_ES

$ locale
LANG=es_ES
LC_CTYPE="es_ES"
...
LC_MESSAGES="es_ES"

Issue the MQ "dspmq" command. Notice that the value for STATUS is shown in Spanish.

$ dspmq
QMNAME(QM_1) STATUS(En ejecución)
QMNAME(QM_2) STATUS(Ha finalizado normalmente)

Answer

You can use the new flag "-n" introduced in MQ 7.0.1 which forces the values used in STATUS to be shown in English, regardless of the language for the locale of the user.

Notice that the values are actually shown in upper-case, such as RUNNING and ENDED NORMALLY.
Thus, you can customize your monitoring script to issue "dspmq -n" and to handle the values in English.

$ dspmq -n
QMNAME(QM_1) STATUS(RUNNING)
QMNAME(QM_2) STATUS(ENDED NORMALLY)

[{"Product":{"code":"SSFKSJ","label":"WebSphere MQ"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Data Conversion","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"9.0;8.0;7.5;7.1;7.0.1","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSYHRD","label":"IBM MQ"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":" ","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Product Synonym

WebSphere MQ WMQ

Document Information

Modified date:
23 June 2018

UID

swg21411562