Syntax: ESCAPESUB statement-label
Discussion: The ESCAPESUB statement sets a default escape subroutine to the specified statement-label. This routine will be executed if the F3 key (escape) is pressed during program execution. Since the escape routine is a true subroutine, the RETURN statement can be executed from the escape routine to return to the main section of the program. Note: Subroutines may be nested to 8 levels.
ESCAPESUB SYSTEM resets the escape condition. Once it is executed, pressing F3/TRANSMIT will escape from the program to the QMONITOR program. When ESCAPESUB is used with no parameters it is treated as ESCAPESUB SYSTEM.
Application note: Use ESCAPESUB at the beginning of a program that needs protection from an operator escape. Also note that whenever an escape is performed and the escape subroutine is executed, the ESCAPESUB must be reset before it will execute again.
Also see ESCAPETO.
ESCAPESUB 9999 . . . 9999 ESCAPESUB 9999 RETURN
In the above example, the ESCAPESUB statement is used at the beginning of the Procedure Division to set a default escape subroutine to statement 9999.
During subsequent program execution, pressing the F3 key will cause the program to branch to statement 9999 (where the ESCAPESUB statement is immediately reset to branch to 9999; the subroutine also returns processing to the main section of the program).