HALT

Description

Terminates an application.

Syntax

HALT {CLOSE}

Usage

When PowerBuilder encounters Halt without the keyword CLOSE, it immediately terminates the application.

When PowerBuilder encounters Halt with the keyword CLOSE, it immediately executes the scripts for application Close event and for the CloseQuery, Close, and Destructor events on all instantiated objects before terminating the application. If there are no scripts for these events, PowerBuilder immediately terminates the application.

You should not code a HALT statement in a component that will run in a server environment. When a PowerBuilder component is running in a J2EE server, and a HALT statement is encountered, instead of aborting the application, which is in this case the server itself, the PowerBuilder VM throws a runtime error and continues. The container is responsible for managing the lifecycle of the component.

Examples

Example 1

This statement stops the application if the user enters a password in the SingleLineEdit named sle_password that does not match the value stored in a string named CorrectPassword:

IF sle_password.Text <> CorrectPassword THEN HALT

Example 2

This statement executes the script for the Close event for the application before it terminates the application if the user enters a password in sle_password that does not match the value stored in the string CorrectPassword:

IF sle_password.Text <> CorrectPassword &
   THEN HALT CLOSE