Terminates program execution and returns to the calling environment.
STOP [errcode [,val1[,val2]]]
STOPE [errcode [,val1[,val2]]]
||Optional A MultiValue error code; commonly (but not always) specified as a positive integer. The error code can be specified as a literal or as a expression that resolves to a literal value. A non-numeric literal value must be specified as a quoted string.
||Optional A comma-separated list of one or more literal values to insert into the error message corresponding to errcode. These insert values can be specified as literals or as expressions that resolves to a literal value. A non-numeric literal value must be specified as a quoted string.
||Optional An expression that resolves to a literal error message text, specified as a quoted string.
All forms of the STOP
statement are used to terminate program execution and return control to the calling environment. If you specify an argument, these statements return an error message before terminating program execution.
return MultiValue error messages. They are nearly functionally identical; both return the specified error code and corresponding error message. STOPE
always returns both the error code and the error message. This includes error messages missing val
insert values. STOP
always returns the error code; it only returns the error message if you have specified at least one of the val
insert values required to complete the error message, or if the error message does not require any insert values. For a list of error codes and corresponding error messages, see Error Messages
in the Caché MultiValue Commands Reference
returns the literal message text specified in message
When you call an MVBasic routine from a non-MultiValue environment, a STOP
statement clears the entire execution stack and either terminates the process or returns to the Terminal prompt.
The following Windows example shows a common use of STOP
as an ELSE clause statement:
OPEN foo TO myfile ELSE STOP 201,foo
The following examples show the difference between STOPE
when the error message requires an insert value that the command does not provide:
OPEN foo TO myfile ELSE STOPE 201
OPEN foo TO myfile ELSE STOP 201
command terminates all program execution and returns to the programming prompt. The STOP
terminates the executing routine and returns control to the calling routine.
During debugging, STOP
terminates the debugging session. The debugger treats an ABORT
as an error condition; the debugger performs a break operation to allow for examination of the condition causing the ABORT