ABORT Statement

The ABORT statement terminates the current program and returns the user to the TCL prompt, regardless of the environment in which the program was executed.

Format

ABORT[errmsg [,parameter1, parameter2, ...]]

Parameter(s)

errmsg

An integer corresponding to an error message from the system message file (ERRMSG). The message is output upon termination of the program. See the Command Reference section for a list of these messages.

parameter1, parameter2, ...

Parameters to be passed to the error message.

Description

The ABORT statement differs from the STOP statement in that a STOP statement returns control to the calling environment (often a Proc), whereas ABORT terminates all calling environments as well as the mvBASIC program. In general, the ABORT statement should be used for abnormal terminations of a program, whereas a STOP statement should be used for normal terminations.

Example

This example demonstrates how the ABORT statement may be used to terminate a program on failure to open a file:

OPEN 'CUSTOMERS' TO CUSTFILE ELSE

   ABORT 201, 'CUSTOMERS'

END

 .

 .

 .

If the CUSTOMERS file is not found, the user receives this message and is returned directly to the TCL prompt:

[201] 'CUSTOMERS' IS NOT A FILE NAME

>

See Also

Statement and Function Reference