The HALT command stops the program execution and cause 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 process has an active M transaction (the value of $TLEVEL is greater than zero (0)), GT.M performs a ROLLBACK prior to terminating.
Because HALT and HANG share the same abbreviation (H), GT.M differentiates them based on whether an argument follows the command.
Example:
$ gtm GTM>HALT $
Because we invoke this GT.M image interactively, the HALT in Direct Mode leaves the process at the shell prompt.