$ZTIMeout

$ZTIMEOUT controls a single process wide timer. The format of the $ZTIMEOUT ISV is:

$ZTIMeout=([timeout][:labelref]) 

Note that GT.M only recognizes interrupts such as from $ZTIMEOUT at points where it can properly resume operation, such as the beginning of a line, when waiting on a command with a timeout, or when starting a FOR iteration. When a timeout occurs, if the last assignment specified no vector, GT.M uses the current $ETRAP or $ZTRAP. GT.M rejects an attempted KILL of $ZTIMeout with the VAREXPECTED error and an attempted NEW of $ZTIMeout with the SVNONEW error.

Example:

GTM>zprint ^ztimeout
ztimeout
  ; Display $ztimeout
    write !,$ztimeout               ; display $ZTIMeout - in this case the initial value -1
                                    ; set with a vector (do ^TIMEOUT)
    set $ztimeout="60:do ^TIMEOUT"  ; timeout of 1 minute. After timeout expires, XECUTEs do ^TIMEOUT
    write !,$ztimeout               ; displays the remaining time:vector until timeout
  ; set without a vector
    set $ztimeout=120               ; set the timeout to 2 minutes without changing the vector
    set $ztimeout="1234do ^TIMEOUT" ; missing colon creates a timeout for 1234 seconds
    set $ztimeout="10:"             ; set the timeout to 10 seconds and vector to current etrap or ztrap
    set $ztimeout=-1                ; set cancels the timeout
  ; Note that set to 0 triggers an immediate timeout
    set $ztimeout=0                 ; triggers the current vector
    set $ztimeout="0:DO FOO"        ; this has the same effect as DO FOO
GTM>