Trigger monitors on IBM i
On IBM® i, instead of the runmqtrm control command, use the IBM MQ for IBM i CL command STRMQMTRM.
Use the STRMQMTRM command as follows:STRMQMTRM INITQNAME(InitQ) MQMNAME(QMgrName)Details are as for runmqtrm.
The following sample programs are also provided, which we can use as models to write your own trigger monitors:
- AMQSTRG4
- This is a trigger monitor that submits an IBM i job for the process that is to be started, but this means that there is additional processing associated with each trigger message.
- AMQSERV4
- This is a trigger server. For each trigger message, this server runs the command for the process in its own job, and can call CICS® transactions.
Both the trigger monitor and the trigger server pass an MQTMC2 structure to the programs that they start. For a description of this structure, see MQTMC2. Both of these samples are delivered in both source and executable forms.
Because these trigger monitors can invoke only native IBM i programs, they cannot trigger Java programs directly, because Java classes are located in the IFS. However, Java programs can be triggered indirectly by triggering a CL program that then invokes the Java program and passes across the TMC2 structure. The minimum size of the TMC2 structure is 732 bytes.
Here is the source of a sample CLP:PGM PARM(&TMC2) DCL &TMC2 *CHAR LEN(800) ADDENVVAR ENVVAR(TM) VALUE(&TMC2) QSH CMD('java_pgmname $TM') RMVENVVAR ENVVAR(TM) ENDPGMThe following trigger monitor program is provided for the IBM MQ MQI client: RUNMQTMC
Call the RUNMQTMC as follows:CALL PGM(QMQM/RUNMQTMC) PARM('-m' QMgrName '-q' InitQ)