Interruption of the screen interaction statements

Screen interaction statements are CONSTRUCT, DISPLAY ARRAY, INPUT, INPUT ARRAY, MENU, and PROMPT. If no DEFER statement has been executed, the Quit and Interrupt keys terminate the execution of these statements and the program itself.

 

If a DEFER INTERRUPT statement has been executed, the Interrupt key can have other functions within the source code. It can be used as a key in an ON KEY clause. If the Interrupt key is pressed and it is not specified as a key for the ON KEY block, the control is passed to the AFTER INPUT or AFTER CONSTRUCT clause. The AFTER FIELD clause is ignored, if any, the int_flag is set to TRUE. The Quit key has no effect on the screen interaction statements if pressed, though the quit_flag is also set to TRUE.

 

To be sure that the int_flag or quit_flag has been reset after the corresponding keys have been pressed, you can reset them to FALSE before the screen interaction statements. If the DEFER INTERRUPT statement has been executed, and the Interrupt key is pressed while the PROMPT or DISPLAY ARRAY statement is executed, the program control is passed to the statement following these statements and the int_flag is set to a non-zero value. When the DEFER INTERRUPT statement has been executed, and the Interrupt key is pressed while the MENU statement is executed, the control remains within the MENU statement.

 

You can specify any other action for the Interrupt key with the help of the ON key clause. The following code checks whether the user has pressed the Interrupt key and defines what actions will be performed if it has been pressed. This is possible only of the DEFER INTERRUPT statement has been previously executed.

MAIN

DEFER INTERRUPT

....

LET int_flag=FALSE

INPUT my_rec.* FROM scr_rec.*

IF int_flag=TRUE THEN

MESSAGE "You have interrupted the input."

END IF

...

END MAIN

 

The INPUT statement has been interrupted, but the program will be executed further, if the user presses the Interrupt key and consequently the int_flag is set to TRUE (non-zero value). The LET statement has previously set int_flag to FALSE to make sure that pressing the Interrupt key during the input will set the int_flag to TRUE.

The int_flag and quit_flag are not reset automatically after the Interrupt or the Quit key has been pressed.

 

To make the Interrupt key interrupt SQL statements, your program must include the DEFER INTERRUPT statement and the OPTIONS statements which contains the SQL INTERRUPT ON clause. Otherwise the SQL statements are uninterruptable. To restore the default uninterruptable behaviour of the SQL statements, use the OPTIONS statement with the SQL INTERRUPT OFF clause.

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.