
Developing and using user-written MQ trigger monitors
You can create your own MQ trigger monitors and use them to serve MQ queues in your CICS® environment, instead of using the CICS-supplied trigger monitor CKTI. This topic provides important instructions for developing and using user-written MQ trigger monitors.
Responsibilities of a user-written MQ monitor program
If you are using an MQMONITOR to process the MQ queue, when the MQMONITOR is started, the EXEC CICS START command starts your trigger monitor transaction with MONDATA prepended with <MQMONITOR_resource_nameUSERID> as the FROM data, so the user-written MQ trigger monitor program must retrieve this data into a structure that matches the description for the MONDATA attribute before issuing any calls to MQ.
Then, before opening the MQ queue, the program should set the state of the MQ monitor as specified in the trigger message to started.
Before returning to CICS, the program should set the state of the MQ monitor to stopped.
Procedure
Your user-written MQ monitor program should perform the following steps in the sequence as indicated below:
- Check that the transaction has been started with data by using an EXEC CICS ASSIGN STARTCODE command.
- Retrieve the FROM data that was passed when your trigger monitor transaction was started into a
structure, by issuing an EXEC CICS RETRIEVE command.
Use the MQMONITOR name that is passed in bytes 2 through 9 of this data for the following steps.
- Issue EXEC CICS SET MQMONITOR(MQMONITOR_name) STARTED to set the state of the MQ monitor as specified in the trigger message to started.
- Open the MQ queue.
- Get messages on the input queue and do the required application logic.
- When ending the program for any reason, issue EXEC CICS SET MQMONITOR(MQMONITOR_name) STOPPED to set the state of the MQ monitor to stopped. Write out the CICS statistics collected when the MQMONITOR was started.
- Return to CICS.
