IB Statements/escapeto

From CometWiki

Jump to: navigation, search

ESCAPETO statement

Syntax: ESCAPETO statement-label

(or)

ESCAPETO SYSTEM


Discussion: The ESCAPETO statement sets a default escape routine to the specified statement-label. This routine will be executed if the F3 key (escape) is pressed during program execution.

ESCAPETO SYSTEM resets the escape condition. Once it is executed, pressing F3/TRANSMIT will escape from the program to the QMONITOR program. When ESCAPETO is used with no parameters it is treated as ESCAPETO SYSTEM.

Application note: Use ESCAPETO at the beginning of a program that needs protection from an operator escape. Also note that whenever an escape is performed and the escape routine is executed, the ESCAPETO must be reset before it will execute again.

Also see ESCAPESUB.

Example:

ESCAPETO 9999
.
5000 .....     ! Main program return point
.
9999    ESCAPETO 9999
       PRINT (0) "PROGRAM INTERRUPTION -- F3 PRESSED."
       PRINT (0) "DO YOU WISH TO CONTINUE (Y/N)?"
       INPUT (0) ANSWER$
       IF ANSWER$ = "Y" THEN GOTO 5000
       RUN "QMONITOR"

In the above example, the ESCAPETO statement is used at the beginning of the Procedure Division to set a default escape routine to statement 9999.

During subsequent program execution, pressing the F3 key will cause the program to branch to statement 9999 (where the ESCAPETO statement is immediately reset to branch to 9999); the routine then prints a message acknowledging that F3 has been pressed and prompts the user to continue or end the program.

If the user enters "Y" in response to the prompt, the program will branch back to statement 5000 (which is not necessarily the place where the user pressed the F3 key). Otherwise, the program will terminate and run "QMONITOR".

Personal tools