setmqenv (set IBM MQ environment)
Use the setmqenv command to set up the IBM® MQ environment on AIX®, Linux®, and Windows.
Purpose
You can use the setmqenv command to automatically set up the environment for
use with an installation of IBM MQ. Alternatively, you
can use the crtmqenv command to create a list of environment variables and values
to manually set each environment variable for your system; see crtmqenv (create IBM MQ environment) for more
information.
Note: Any changes you make to the environment are not persistent. If you log out, and
log in again, your changes are lost.
You can specify which installation the environment is set up for by specifying a queue manager name, an installation name, or an installation path. You can also set up the environment for the installation that issues the setmqenv command by issuing the command with the -s parameter.
The setmqenv command sets the following environment variables, appropriate to
your system:
- CLASSPATH
- INCLUDE
- LIB
- MANPATH
- MQ_DATA_PATH
- MQ_ENV_MODE
- MQ_FILE_PATH
- MQ_INSTALLATION_NAME
- MQ_INSTALLATION_PATH
- MQ_JAVA_INSTALL_PATH
- MQ_JAVA_DATA_PATH
- MQ_JAVA_LIB_PATH
- MQ_JAVA_JVM_FLAG
- MQ_JRE_PATH
- PATH
Usage notes
- The setmqenv command removes all directories for all IBM MQ installations from the environment variables before adding
new references to the installation for which you are setting up the environment for. Therefore, if
you want to set any additional environment variables that reference IBM MQ, set the variables after issuing the
setmqenv command. For example, if you want to add
MQ_INSTALLATION_PATH/java/lib
to LD_LIBRARY_PATH, you must do so after running the setmqenv command. - In some shells, command-line parameters cannot be used with setmqenv and any
setmqenv command issued is assumed to be a
setmqenv -s
command. The command produces an informational message that the command has been run as if asetmqenv -s
command had been issued. Therefore, in these shells you must ensure that you issue the command from the installation for which you want to set the environment for. In these shells, you must set the LD_LIBRARY_PATH variable manually. Use the crtmqenv command with the -l or -k parameter to list the LD_LIBRARY_PATH variable and value. Then use this value to set the LD_LIBRARY_PATH.
Syntax
Optional Parameters
- -m QMgrName
- Set the environment for the installation associated with the queue manager QMgrName.
- -n InstallationName
- Set the environment for the installation named InstallationName.
- -p InstallationPath
- Set the environment for the installation in the path InstallationPath.
- -r
- Remove all installations from the environment.
- -s
- Set the environment for the installation that issued the setmqenv command.
- -k
- Applies to AIX and Linux only. If the
-k flag is specified:
- On AIX, the LIBPATH environment variable is set.
- On Linux, the LD_LIBRARY_PATH environment variable is set.
- -l
- Applies to AIX and Linux only. If the
-l flag is specified:
- On AIX, the LIBPATH environment variable is set.
- On Linux, the LD_LIBRARY_PATH environment variable is set.
- -x Mode
- Mode can take the value 32 or 64.
Return codes
Return code | Description |
---|---|
0 | Command completed normally. |
10 | Command completed with unexpected results. |
20 | An error occurred during processing. |
Examples
The following examples assume that a copy of IBM MQ is installed in the /opt/mqm
directory on an AIX or Linux system.
Notes:
- The period character
(.)
used at the beginning of each command makes the setmqenv script run in the current shell. Therefore, the environment changes made by the setmqenv script are applied to the current shell. Without the period character(.)
, the environment variables are changed in another shell, and the changes are not applied to the shell from which the command is issued. - Some shells, for example the Ubuntu 18.04
default shell, do not pass parameters when you use the period character at the beginning of a
command. If you are using such a shell, the following warning is issued and any parameters to the
command are
ignored:
The environment has been set for the installation from which the setmqenv command was issued.$ . /opt/mqm/bin/setmqenv -sAMQ8588W: No parameter was detected.
To pass parameters into setmqenv for such shells, you must use the following environment variable: MQ_ENV_OPTIONS=<your options>.
For example, to remove IBM MQ from the environment, issue the command:$ MQ_ENV_OPTIONS=-r . /opt/mqm/bin/setmqenv
- The following command sets up the environment for an installation installed in the
/opt/mqm directory:
. /opt/mqm/bin/setmqenv -s
- The following command sets up the environment for an installation installed in the
/opt/mqm2 directory, and includes the path to the installation at the end of
the current value of the LD_LIBRARY_PATH variable:
. /opt/mqm/bin/setmqenv -p /opt/mqm2 -l
- The following command sets up the environment for queue manager
QM1
in a 32-bit environment:. /opt/mqm/bin/setmqenv -m QM1 -x 32
The following example assumes that a copy of IBM MQ is installed in C:\Program Files\IBM\MQ on a Windows system. This command sets up the environment for an
installation called
Installation1
:
"C:\Program Files\IBM\MQ\bin\setmqenv.cmd" -n Installation1