Progress
Programming
Handbook


Overriding the Default Handling

The default handling for the STOP condition is almost always appropriate. However, you can override the default handling by adding the ON STOP phrase to a REPEAT, FOR EACH, or DO statement:

p–stop.p
FOR EACH Customer ON ERROR UNDO, LEAVE 
                  ON STOP UNDO, RETRY: 
   IF RETRY 
   THEN DO: 
      MESSAGE "The STOP condition has occurred." SKIP 
              "Do you wish to continue?" VIEW-AS ALERT-BOX QUESTION 
              BUTTONS yes-no UPDATE continue-ok AS LOGICAL. 
      IF NOT continue-ok 
      THEN UNDO, LEAVE. 
   END. 
   UPDATE Customer. 
END. 

In p-stop.p, the ON ERROR and ON STOP phrases cause the FOR EACH loop to retry if and only if the STOP condition occurs. When this happens, the procedure displays an alert box that lets you decide whether to continue.


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