Start of change

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:

  1. Check that the transaction has been started with data by using an EXEC CICS ASSIGN STARTCODE command.
  2. 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.

  3. Issue EXEC CICS SET MQMONITOR(MQMONITOR_name) STARTED to set the state of the MQ monitor as specified in the trigger message to started.
  4. Open the MQ queue.
  5. Get messages on the input queue and do the required application logic.
  6. 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.
  7. Return to CICS.
CAUTION:
If the user-written MQ trigger monitor program fails to perform the steps in the sequence as described in the preceding procedure, unpredictable consequences might occur; for example, recorded statistics will be unpredictable, and the MQMONITOR will be in an unpredictable state.


user-written-trigger-monitor-prog.html | Timestamp icon Last updated: Sunday, 4 June 2017
End of change