DataBasic Reference > Statements and Intrinsic Functions > S > STOP Statement

Comment on this topic

Documentation Comments

Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.

Reality V15.0 ()

STOP Statement (DataBasic) (m618703+stop_s.htm)

To

Reality

Version

Topic

Submitted by

Company

Location

Email address

Comment

 

 

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
Item T11 in ERRMSG file Item T12 in ERRMSG file
L (2) L (2)
E Could not find H***
A H Item
H file! R (5)
L H does not exist!
H Check file L
H definition! D
  L
  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

RealityV15.0Comment on this topic