ABORT

ABORT, ABORTE, ABORTM

Top  Previous  Next

 

The ABORT statement terminates the current program, returning to the command prompt. ABORTE and ABORTM provide compatibility with other multivalue database products.

 

 

Format

 

ABORT {message}

 

where

 

messageevaluates to the message to be displayed. Although this is optional, an ABORT with no message is likely to be hard to debug.

 

 

If an ON.ABORT paragraph is defined in the VOC, this will be executed before the command prompt is issued.

 

The program location at which the abort was generated will be reported unless the SUPPRESS.ABORT.MSG option has been set using the OPTION command.

 

Because ABORT terminates all active programs, menus, paragraphs, etc., it should only be used to handle error conditions.

 

 

The Pick syntax of ABORT can be enabled by including a line

$MODE PICK.ERRMSG

in the program before the first ABORT statement. This mode is also selected automatically if there is a comma after message.

 

In this syntax, the ABORT statement becomes

 

ABORT {message {, arg...}}

 

where

 

messageevaluates to the id of a record in the ERRMSG file which holds the message to be displayed. If this id is numeric, it will be copied to @SYSTEM.RETURN.CODE.

 

arg...is an optional comma separated list of arguments to be substituted into the message.

 

See the ERRMSG statement for a description of the ERRMSG file message format.

 

 

The ABORTE statement always uses Pick style message handling and the ABORTM statement always uses Information style message handling, regardless of the setting of the PICK.ERRMSG option.

 

 

Examples

 

IF NO.OF.ENTRIES = 0 THEN ABORT

 

This statement aborts to the command prompt if the value of the variable NO.OF.ENTRIES is zero. No error message is printed. ABORT statements without error text messages can result in difficult diagnostic work to locate faults.

 

 

OPEN "STOCK.FILE" TO STOCK ELSE

  ABORT "Cannot open STOCK.FILE - Error " : STATUS()

END

 

This program fragment attempts to open a file named STOCK.FILE. If the open fails, the program displays an error message and aborts to the command prompt.

 

 

See also:

ERRMSG, STOP