Sample task termination exit
IBM MQ supplies sample source code for a CICS task termination exit.
The sample source code is in the following directories:
Platform | Directory | Source file |
---|---|---|
UNIX and Linux systems | MQ_INSTALLATION_PATH/samp | amqzscgx.c |
Windows | MQ_INSTALLATION_PATH\Tools\c\Samples | amqzscgn.c |
MQ_INSTALLATION_PATH represents the high-level directory in which IBM MQ is installed.
The build instructions for the sample task termination exit are contained in the comments in each source file.
This exit is invoked by CICS at normal and abnormal task termination (after any sync point has been taken). No recoverable work is permitted in the exit program.
These functions are only used in an IBM MQ and CICS context in which the CICS version supports the XA interface. CICS refers to these libraries as programs or user exits.
CICS has a number of user exits and amqzscgx, if used, is defined and enabled on CICS as the Task termination user exit (UE014015), that is, exit number 15.
When the task termination exit is called by CICS, CICS has already informed IBM MQ of the task's termination state and IBM MQ has taken the appropriate action (commit or rollback). All the exit does is to issue an MQDISC to clean up.
One purpose of installing and configuring your CICS system to use a task termination exit is to protect the system against some of the consequences of faulty application code. For example, if your CICS transaction ends abnormally without first calling MQDISC, and has no task termination exit installed, then you might see (within around 10 seconds) a subsequent unrecoverable failure of the CICS region. This is because IBM MQ health thread, which runs in the cicsas process, will not have been posted and given time to clean up and return. The symptoms might be that the cicsas process ends immediately, having written FFST reports to /var/mqm/errors or the equivalent location on Windows.
Parent topic: Enable CICS user exits