crtmqenv (create IBM MQ environment)

Create a list of environment variables for an installation of IBM MQ, on UNIX, Linux, and Windows.


Purpose

We can use the crtmqenv command to create a list of environment variables with the appropriate values for an installation of IBM MQ. The list of environment variables is displayed on the command line, and any variables that exist on the system have the IBM MQ values added to them. This command does not set the environment variables for you, but gives you the appropriate strings to set the variables yourself, for example, within your own scripts.

If we want the environment variables set for you in a shell environment, we can use the setmqenv command instead of using the crtmqenv command.

We can specify which installation the environment is created for by specifying a queue manager name, an installation name, or an installation path. We can also create the environment for the installation that issues the crtmqenv command by issuing the command with the -s parameter.

This command lists the following environment variables, and their values, appropriate to the 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 crtmqenv command removes all directories for all IBM MQ installations from the environment variables before adding new references to the installation for which we are setting up the environment. Therefore, if you want to set any additional environment variables that reference IBM MQ, set the variables after issuing the crtmqenv command. For example, if we want to add MQ_INSTALLATION_PATH/java/lib to LD_LIBRARY_PATH, we must do so after running crtmqenv.


Syntax

crtmqenv -mQMgrName-nInstallationName-pInstallationPath-r-s -k-l -xMode -i


Required Parameters

    -m QMgrName
    Create the environment for the installation associated with the queue manager QMgrName.

    -n InstallationName
    Create the environment for the installation named InstallationName.

    -p InstallationPath
    Create the environment for the installation in the path InstallationPath.

    -r
    Remove all installations from the environment.

    -s
    Create the environment for the installation that issued the command.


Optional Parameters

    -k
    Applies to UNIX 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.

    Include the LD_LIBRARY_PATH, or LIBPATH, environment variable in the environment, adding the path to the IBM MQ libraries at the start of the current LD_LIBRARY_PATH, or LIBPATH, variable.

    -l
    Applies to UNIX 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.

    Include the LD_LIBRARY_PATH, or LIBPATH, environment variable in the environment, adding the path to the IBM MQ libraries at the end of the current LD_LIBRARY_PATH, or LIBPATH, variable.

    -x Mode
    Mode can take the value 32, or 64.
    Create a 32-bit or 64-bit environment:

    • If you specify -x 32, the PATH environment variable is changed to add a prefix to the binary path for 32 bit executables.
    • If you specify -x 64, the PATH environment variable is changed to add a prefix to the binary path for 64 bit executables.

    If this parameter is not specified, the environment matches that of the queue manager or installation specified in the command.
    Any attempt to display a 64-bit environment with a 32-bit installation fails.

    -i
    List only the additions to the environment.
    When this parameter is specified, the environment variables set for previous installations remain in the environment variable path and must be manually removed.


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 /opt/mqm on a UNIX or Linux system.
  1. This command creates a list of environment variables for an installation installed in /opt/mqm:
    /opt/mqm/bin/crtmqenv -s
    
  2. This command creates a list of environment variables for an installation installed in /opt/mqm2, and includes the path to the installation at the end of the current value of the LD_LIBRARY_PATH variable:
    /opt/mqm/bin/crtmqenv -p /opt/mqm2 -l
    
  3. This command creates a list of environment variables for the queue manager QM1, in a 32-bit environment:
    /opt/mqm/bin/crtmqenv -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.

  1. This command creates a list of environment variables for an installation called installation1:
    "C:\Program Files\IBM\MQ\crtmqenv" -n installation1
    


Related reference


Related information