Front-end termination

The OPTIONS CLOSE APPLICATION instruction defines the callback function in case of front-end termination.

Syntax

OPTIONS ON CLOSE APPLICATION CALL function

Usage

The OPTIONS ON CLOSE APPLICATION CALL function can be used to execute specific code when the front-end stops. For example, when the front-end program is stopped, when the user workstation session is ended, or when the workstation is shut down.

Before stopping, the front-end sends an internal event that is trapped by the runtime system. When a callback function is specified with this program option command, the application code that was executing is canceled, and the callback function is executed before the program stops.

Use the OPTIONS ON CLOSE APPLICATION CALL function instruction with care, and do not execute complex code in the callback function. The code is expected to contain only simple and short cleanup operations; any interactive instruction must be avoided.

Important: A front-end program crash or network failure is not detected and cannot be handled by the ON CLOSE APPLICATION option.