The ZHALT command stops program execution and causes GT.M to return control to the invoking environment/program with a return code.
The format of the ZHALT command is:
ZHALT[:tvexpr] [intexpr]
The optional truth-valued expression immediately following the command is a command postconditional that controls whether GT.M executes the command.
The optional integer expression specifies the return code. If an integer expression is not specified, ZHALT returns 0. Because UNIX limits return codes to zero through 255, ZHALT returns intexpr modulo 256, unless the intexpr is non-zero but the intexpr modulo 256 is zero, in which case ZHALT returns a (non-success) value of 255 so that the return code is non-zero.
If no arguments are specified, at least two (2) spaces must follow the command to separate it from the next command on the line. Note that additional commands do not serve any purpose unless the ZHALT has a postconditional.
A ZHALT releases all shared resources held by the process, such as devices OPENed in GT.M, databases, and GT.M LOCKs. If the process has an active M transaction (the value of $TLEVEL is greater than zero (0)), GT.M performs a ROLLBACK prior to terminating.