$ZTE[XIT] contains an expression that controls the GT.M interrupt facility at the transaction commit or rollback. At each outermost TCOMMIT or TROLLBACK, If +$ZTEXIT evaluates to non-zero (TRUE), then $ZINTERRUPT is XECUTEd after completing the commit or rollback.
$ZTEXIT is a read-write ISV, that is, it can appear on the left side of the equal sign (=) in the argument to the SET command. M routines cannot NEW $ZTEXIT. GT.M initializes $ZTEXIT to null at the process startup. Note that the changes to the value of $ZTEXIT during a GT.M invocation last for the entire duration of the process, so it is the application's responsibility to reset $ZTEXIT after $ZINTERRUPT is delivered in order to turn off redelivering the interrupt every subsequent transaction commit or rollback.
Example:
$ export sigusrval=10
$ /usr/lib/fis-gtm/V6.1-000_x86_64/gtm
GTM>zprint ^ztran
foo;
set $ztexit=1
set $zinterrupt="d ^throwint"
tstart ()
for i=1:1:10 do
. set ^ACN(i,"bal")=i*100
tstart ()
do ^throwint
;do ^proc
tcommit:$tlevel=2
for i=1:1:10 do
. set ^ACN(i,"int")=i*0.05
;do ^srv
if $tlevel trollback
;do ^exc
set $ztexit="",$zinterrupt=""
quit
bar;
write "Begin Transaction",!
set $ztexit=1
tstart ()
i '$zsigproc($j,$ztrnlnm("sigusrval")) write "interrupt sent...",!!
for i=1:1:4 set ^B(i)=i*i
tcommit
write "End Transaction",!
;do ^srv
quit
GTM>zprint ^throwint
throwint
set $zinterrupt="write !,""interrupt occurred at : "",$stack($stack-1,""PLACE""),! set $ztexit=1"
if '$zsigproc($job,$ztrnlnm("sigusrval")) write "interrupt sent to process"
write "***************************************",!!
quit
GTM>do foo^ztran
interrupt sent to process
interrupt occurred at : throwint+3^throwint
***************************************
interrupt occurred at : foo+13^ztran
GTM>
In the above call to foo^ztran, the interrupt handler is a user-defined routine, throwint. The process is sent a signal (SIGUSR1), and $ZINTERRUPT is executed. At the outermost trollback, the interrupt is rethrown, causing $ZINTERRUPT to be executed again.
Example:
GTM>w $zinterrupt
"IF $ZJOBEXAM()"
GTM>zsystem "ls GTM*"
ls: No match.
GTM>do bar^ztran
Begin Transaction
interrupt sent...
End Transaction
GTM>zsystem "ls GTM*"
GTM_JOBEXAM.ZSHOW_DMP_3951_1 GTM_JOBEXAM.ZSHOW_DMP_3951_2
GTM>
This uses the default value of $ZINTERRUPT to service interrupts issued to the process. The $ZJOBEXAM function executes a ZSHOW "*", and stores the output in each GTM_ZJOBEXAM_ZSHOW_DMP for the initial interrupt, and at tcommit when the interrupt is rethrown.