STOP Statement
Halts execution of a DataBasic program and optionally displays a message from the system messages file.
Syntax
STOP {message-id {,parameter} ...}
Syntax elements
message-id The item-id of the item containing the message in the system message file (ERRMSG). If the specified item cannot be found, the item-id is displayed, followed by any parameters supplied.
parameter An expression that evaluates to a string to be included in the error message; each parameter replaces an A, A(n) or R(n) message format code in the error message item.
Comments
STOP functions in the same way as the ABORT statement, except that it will not terminate a driving Proc.
Example 1
A=50; B=750; C=235; D=1300 REVENUE = A+B; COST = C+D PROFIT = REVENUE - COST IF PROFIT > 1 THEN GOTO 100 PRINT "ZERO PROFIT OR LOSS" STOP 100 PRINT "POSITIVE PROFIT"
If PROFIT is less than or equal to 1, ZERO PROFIT OR LOSS
is printed and program execution stops; otherwise, POSITIVE PROFIT
is printed and the program continues.
Example 2
OPEN "INV" TO INV ELSE STOP "T11","INV" . . ERR="T12" FOR I=1 TO 10 ITEM.ID = "A*":I READ ITEM FROM INV, ITEM.ID ELSE STOP ERR,ITEM.ID END WRITE ITEM ON TEST,I NEXT I END
In the following table, ◦ denotes a trailing space character.
Item T11 in ERRMSG file |
Item T12 in ERRMSG file |
---|---|
L |
L |
E Could not find◦ |
H*** |
A |
H Item◦ |
H file! |
R(5) |
L(2) |
H does not exist! |
H Check file definition! |
L(2) |
|
D |
|
L(2) |
|
T |
If INV does not exist, the following message is displayed:
[T11] Could not find INV file!
Check file definition!
If item A*7 is not present, this message is displayed:
*** Item A*7 does not exist!
12 Apr 1995
11:35:32