Use the setmqenv command to run with both versions of IBM MQ
The installation activities are complete and we can now verify the directories containing the IBM MQ code.
Before starting
Ensure that we have correctly installed the IBM MQ Version 8.0.0 product, Installation1, in C:\Program Files\IBM\WebSphere MQ\ and the IBM MQ Version 9.1 product, Installation2, in C:\Program Files\IBM\MQ.
About this task
Use the dspmqinst command to display the installation information of the versions installed in the system without the need to take a look at the directories, and the dspmqver command to display the version information.
On Windows systems the information is kept in the registry and the installation configuration information is held in the following key: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\IBM\WebSphere MQ\Installation.Important: We must not edit or reference this key directly.Procedure
- Display the installation information using the dspmqinst
command.
InstName: Installation1 InstDesc: Identifier: 1 InstPath: C:\Program Files\IBM\WebSphere MQ Version: 8.0.0.9 Primary: Yes State: Available MSIProdCode: {74F6B169-7CE6-4EFB-8A03-2AA7B2DBB57C} MSIMedia: 8.0 Server MSIInstanceId: 1 InstName: Installation2 InstDesc: Identifier: 2 InstPath: C:\Program Files\IBM\MQ Version: 9.1.0.0 Primary: No State: Available MSIProdCode: {5D3ECA81-BF8D-4E80-B36C-CBB1D69BC110} MSIMedia: 9.1 Server MSIInstanceId: 1
Note: The respective installation names (InstName) are important. - Display the version of IBM MQ using
dspmqver for the default (or primary) installation:
C:\> dspmqver Name: WebSphere MQ Version: 8.0.0.9 Level: p800-009-180321.1 BuildType: IKAP - (Production) Platform: WebSphere MQ for Windows (x64 platform) Mode: 64-bit O/S: Windows 10 Professional x64 Edition, Build 18363 InstName: Installation1 InstDesc: Primary: Yes InstPath: C:\Program Files\IBM\WebSphere MQ DataPath: C:\ProgramData\IBM\MQ MaxCmdLevel: 802 LicenseType: Production
After running the command you receive the following message: Note there are a number (1) of other installations, use the '-i' parameter to display them. - Issue the command, C:\> where dspmqver, and you see information about
the primary installation:
C:\> where dspmqver C:\Program Files\IBM\WebSphere MQ\bin64\dspmqver.exe C:\Program Files\IBM\WebSphere MQ\bin\dspmqver.exe
- To see the information about the IBM MQ Version 9.1 product issue the following command, C:\> setmqenv -n Installation2.
- Issue the command C:\> where dspmqver again and you see information
about the second installation:
C:\> where dspmqver C:\Program Files\IBM\MQ\bin64\dspmqver.exe C:\Program Files\IBM\MQ\bin\dspmqver.exe
- Issue the command C:\dspmqver again. You now
see:
C:\> dspmqver Name: IBM MQ Version: 9.1.0.0 Level: p910-L180705 BuildType: IKAP - (Production) Platform: IBM MQ for Windows (x64 platform) Mode: 64-bit O/S: Windows 10 Professional x64 Edition, Build 18363 InstName: Installation2 InstDesc: Primary: No InstPath: C:\Program Files\IBM\MQ DataPath: C:\ProgramData\IBM\MQ MaxCmdLevel: 910 LicenseType: Production
- Issue the command C:\ set MQ, and after using
setmqenv you see information about the second installation.
C:\> set MQ MQ_DATA_PATH=C:\ProgramData\IBM\MQ MQ_ENV_MODE=64 MQ_FILE_PATH=C:\Program Files\IBM\MQ MQ_INSTALLATION_NAME=Installation2 MQ_INSTALLATION_PATH=C:\Program Files\IBM\MQ MQ_JAVA_DATA_PATH=C:\ProgramData\IBM\MQ MQ_JAVA_INSTALL_PATH=C:\Program Files\IBM\MQ\java MQ_JAVA_LIB_PATH=C:\Program Files\IBM\MQ\java\lib64 MQ_JRE_PATH=C:\Program Files\IBM\MQ\java\jre
We can create a batch file that will run the setmqenv command with the specified syntax. Ensure you have this batch file in a directory in your PATH, for example, C:\WinTools.For example, we can create the batch file set-mq-910.bat with the contents:REM Setup the environment to run MQ 9.1 CALL "C:\Program Files\IBM\MQ\bin\setmqenv" -n Installation2 REM Adding Samples to the path SET PATH=%PATH%;%MQ_FILE_PATH%\Tools\c\Samples\Bin;%MQ_FILE_PATH%\Tools\c\Samples\Bin64 ;%MQ_FILE_PATH%\Tools\jms\samples;%MQ_JAVA_INSTALL_PATH%\bin\ dspmqver -f 2
Notes:- We need to use the "CALL" argument when invoking setmqenv. Without this argument, the processing of setmqenv ends the batch and doesnot allow following statements to run. That is, with the CALL argument, you allow other statements in the batch file to be processed.
- If you add an IBM MQ directory into your PATH, such
as the location for the C-samples: PATH=…;C:\Program
Files\IBM\MQ\tools\c\Samples\Bin;… this directory will be REMOVED by
setmqenv the next time the command runs.
To be able to run the C-samples from IBM MQ Version 9.1, the last line in the preceding batch file is needed, in order to place the directory for the samples back into the PATH.
Notice also that MQ_FILE_PATH is used in order to use the proper directory structure for IBM MQ Version 9.1: SET PATH=%PATH%;%MQ_FILE_PATH%\tools\c\Samples\Bin.
Parent topic: Installing a later version of IBM MQ to coexist with an earlier version on Windows Previous topic: Installing IBM MQ Version 9.1 side-by-side to IBM MQ Version 8.0 Next topic: Create a queue manager in IBM MQ Version 9.1