DEFER
The DEFER statement prevents 4GL from terminating program execution when the
user presses the Interrupt key or the Quit key.
DEFER is a method of intercepting asynchronous signals from outside the
program.
Unless it includes the DEFER statement, the 4GL application terminates
whenever the user presses the Interrupt key or the Quit key. The Interrupt key is
CONTROL-C, and the Quit key is CONTROL-\. (Here the Quit key emulates the effect of
the Quit key on UNIX systems.)
The DEFER statement tells 4GL to set a built-in global variable to a non-zero
value, rather than terminate, when the user presses one of these keys:
If the user presses the Interrupt key when DEFER INTERRUPT has been specified,
4GL sets the built-in global variable int_flag to TRUE.
If the user presses the Quit key when DEFER QUIT has been specified, 4GL sets
the built-in global variable quit_flag to TRUE.
The DEFER INTERRUPT and DEFER QUIT statements can appear only in the MAIN
program block, and only once there in any program. Once executed, the DEFER
statement remains in effect for the duration of the program; you cannot restore the
original function of the Interrupt key or the Quit key.
4GL programs can include code to check whether int_flag or quit_flag is TRUE,
and if so, to take appropriate action. Be sure also to reset int_flag or
quit_flag to FALSE (that is, to zero) so that subsequent tests are valid.
References
CONSTRUCT
DISPLAY ARRAY
INPUT
INPUT ARRAY
MAIN
MENU
PROMPT
WHENEVER