Progress
Language Reference


STOP Statement

Interfaces
OS
SpeedScript
All
All
Yes

Signals the STOP condition in the current block. By default, the STOP condition stops processing a procedure, backs out the active transaction, and returns to the startup procedure or to the Progress Editor. You can change this behavior by including the ON STOP phrase on a block header.

SYNTAX

STOP 

EXAMPLES

In any procedure, the outermost block that updates the database is the system transaction. In this procedure, the first iteration of the FOR EACH block starts a system transaction. The transaction ends when that iteration ends. Another transaction starts at the start of the next iteration. After you update the credit-limit field, Progress prompts you to STOP. If you enter yes, the STOP statement stops the procedure and undoes any database modifications made in that transaction.

r-stop.p
DEFINE VARIABLE ans AS LOGICAL.

FOR EACH customer:
  DISPLAY cust-num name.
  UPDATE credit-limit.
  ans = no.
  MESSAGE "Stopping now undoes changes to this record.".
  MESSAGE "Do you want to stop now?" UPDATE ans.
  IF ans THEN STOP.
END. 

When you add the ON STOP phrase to the block statement of the previous procedure, it changes the default behavior of the STOP statement. In this procedure, Progress allows you to re-enter the record when you choose to stop.

r-stop2.p
DEFINE VARIABLE ans  AS LOGICAL.
FOR EACH customer ON STOP UNDO, RETRY:
  DISPLAY cust-num name.
  UPDATE credit-limit.
  ans = NO.
  MESSAGE "Stopping now undoes changes to this record."
    "Do you want to stop now?" VIEW-AS ALERT-BOX QUESTION
    BUTTONS YES-NO UPDATE ans.
  IF ans THEN STOP.
END. 

NOTES

SEE ALSO

ON STOP Phrase


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095