[IBMi]

Setting up IBM MQ on IBM i with Java and JMS

This collection of topics gives an overview of how you set up and test IBM® MQ with Java and JMS on IBM i using CL commands or the qshell environment.

Note: From IBM MQ 8.0, ldap.jar, jndi.jar and jta.jar are part of the JDK.

Using CL commands

The CLASSPATH that you set, is for testing with MQ base Java, JMS with JNDI, and JMS without JNDI.

If you do not use a .profile file under your /home/Userprofile directory, you will need to set the system level environment variables below. You can check to see if they are set using the WRKENVVAR command.
  1. To view the environment variables for the entire system issue the command: WRKENVVAR LEVEL(*SYS)
  2. To view the environment variables specific to your job issue the command : WRKENVVAR LEVEL(*JOB)
  3. If the CLASSPATH is not set, do the following:
    
    ADDENVVAR ENVVAR(CLASSPATH)
           VALUE('.:/QIBM/ProdData/mqm/java/lib/com.ibm.mq.jar
           :/QIBM/ProdData/mqm/java/lib/connector.jar:/QIBM/ProdData/mqm/java/lib
           :/QIBM/ProdData/mqm/java/samples/base
           :/QIBM/ProdData/mqm/java/lib/com.ibm.mqjms.jar
           :/QIBM/ProdData/mqm/java/lib/jms.jar
           :/QIBM/ProdData/mqm/java/lib/providerutil.jar
           :/QIBM/ProdData/mqm/java/lib/fscontext.jar:') LEVEL(*SYS) 
    
  4. If QIBM_MULTI_THREADED is not set, issue the following command:
    
    ADDENVVAR ENVVAR(QIBM_MULTI_THREADED) VALUE('Y') LEVEL(*SYS)
    
  5. If QIBM_USE_DESCRIPTOR_STDIO is not set, issue the following command:
    
    ADDENVVAR ENVVAR(QIBM_USE_DESCRIPTOR_STDIO) VALUE('I') LEVEL(*SYS)
    
  6. If QSH_REDIRECTION_TEXTDATA is not set , issue the following command:
    
    ADDENVVAR ENVVAR(QSH_REDIRECTION_TEXTDATA) VALUE('Y') LEVEL(*SYS)
    

Using the qshell environment

If you use the QSHELL environment, you can setup a .profile in your /home/Userprofile directory. For more information reference the Qshell Interpreter (qsh) documentation.

Specify the following in the .profile. Note that the CLASSPATH statement must be on a single line, or separated onto different lines using the \ character as shown.

CLASSPATH=.:/QIBM/ProdData/mqm/java/lib/com.ibm.mq.jar: \
/QIBM/ProdData/mqm/java/lib/connector.jar: \
/QIBM/ProdData/mqm/java/lib: \
/QIBM/ProdData/mqm/java/samples/base: \
/QIBM/ProdData/mqm/java/lib/com.ibm.mqjms.jar: \
/QIBM/ProdData/mqm/java/lib/jms.jar: \
/QIBM/ProdData/mqm/java/lib/providerutil.jar: \
/QIBM/ProdData/mqm/java/lib/fscontext.jar: 
HOME=/home/XXXXX
LOGNAME=XXXXX
PATH=/usr/bin:
QIBM_MULTI_THREADED=Y QIBM_USE_DESCRIPTOR_STDIO=I
QSH_REDIRECTION_TEXTDATA=Y
TERMINAL_TYPE=5250

Ensure that the QMQMJAVA library is in the library list by issuing the command DSPLIBL.

If the QMQMJAVA library is not in the list, add it using the following command: ADDLIBLE LIB(QMQMJAVA)