The HALT command stops GT.M program execution and causes GT.M to return control to the operating system environment that invoked the GT.M image.
The format of the HALT command is:
H[ALT][:tvexpr]
The optional truth-valued expression immediately following the command is a command postconditional that controls whether GT.M executes the command.
Because the HALT command has no argument, 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 HALT has a postconditional.
A HALT releases all shared resources held by the process, such as devices OPENed in GT.M, databases, and GT.M LOCKs. If the value of $TLEVEL is greater than zero (0), a ROLLBACK is performed.
Because HALT and HANG share the same abbreviation (H), GT.M differentiates them based on whether an argument follows the command.
Example:
$ gtm
%GTM-I-BREAK, Break instruction encountered
At M source location +1^GTM$DMOD
GTM>HALT
$
Because we invoke this GT.M image interactively, the HALT in Direct Mode leaves the process at the DCL prompt.