The SET.BREAK.HANDLER statement allows a program to establish a handler subroutine that will be called if the user presses the break key.
The break handler subroutine will be called if the break key is enabled and the user presses it. The subroutine takes a single argument through which it returns an action code telling QM how to handle the break. Possible return values are:
Any other value will display the normal break key action prompt.
The handler applies to the program that establishes it and to all programs called from it unless they establish their own break handler. The handler may perform any appropriate application processing to determine the action code to be returned but must not execute a STOP or ABORT statement internally.
The break handler will be deactivated when the program that established it terminates. The program can also use REMOVE.BREAK.HANDLER to deactivate the handler while the program continues to run. A program cannot remove the break handler of another program further down the call stack. On deactivation of a break handler, any handler belonging to a program further down the call stack becomes active again.