To prevent a 4GL application from termination while executing, if the Interrupt key or Quit key is pressed, use the DEFER statement.
The DEFER statement can be followed either by the INTERRUPT keyword (to prevent a program from termination on pressing the Interrupt key) or by QUIT keyword (to prevent a program from termination on pressing the Quit key). A program that contains no DEFER statement will be terminated if either of these keys is pressed. By default, the Interrupt key is CONTROL-C and the Quit key is CONTROL-\.
If the source code contains a DEFER statement, either the int_flag or quit_flag built-in variable is set to a non-zero value. The int_flag is set to TRUE, if the DEFER INTERRUPT statement is in effect. The quit_flag is set to TRUE when the DEFER QUIT statement is in effect.
The DEFER statement can appear only within the MAIN block and only once in a program. This statement remains in effect after it has been executed, the default actions for the Quit and Interrupt keys cannot be restored. The code which checks the status of the int_flag and quit_flag variables can be included into a program.
Querix offers an alternative to the DEFER INTERRUPT and DEFER QUIT commands. They now can be handled using the global event handlers. For more details, refer here.