STOP

STOP, STOPE, STOPM

Top  Previous  Next

 

The STOP statement terminates the current program. STOPE and STOPM provide compatibility with other multivalue database products.

 

 

Format

 

STOP {message}

 

where

 

messageevaluates to the message to be displayed.

 

 

Control is passed to the calling program, menu or paragraph.

 

 

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

$MODE PICK.ERRMSG

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

 

In this syntax, the STOP statement becomes

 

STOP {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 STOPE statement always uses Pick style message handling and the STOPM statement always uses Information style message handling, regardless of the setting of the PICK.ERRMSG option.

 

 

Examples

 

IF NO.OF.ENTRIES = 0 THEN STOP

 

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

 

 

OPEN "STOCK.FILE" TO STOCK ELSE

  STOP "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 terminates the program.

 

See also:

ABORT, ERRMSG