Progress
Programming
Handbook


The ERROR–STATUS System Handle

Many Progress statements support the NO–ERROR option. If you specify this option, the ERROR condition is not generated by that statement. Instead, if the statement cannot execute properly, execution continues with the next statement. You can subsequently check whether an error occurred by examining the attributes of the ERROR–STATUS system handle.

The ERROR–STATUS handle contains information on the last statement executed with the NO–ERROR option. You can determine whether Progress attempted to raise the error condition in that statement by reading the value of the ERROR attribute of ERROR–STATUS. To retrieve the error messages and error numbers, first read the value of the NUM–MESSAGES attribute, then use the methods ERROR–STATUS:GET–MESSAGE(n) and ERROR–STATUS:GET–NUMBER(n). For more information on these methods, see the Progress Language Reference section on the ERROR–STATUS System Handle.

The ERROR–STATUS:ERROR attribute remains true until the completion of the next statement with the NO–ERROR option.

The following program attemps to retrieve a record from the customer table with NO–ERROR. If an error occurs, you are prompted to display the message:

p–errst2.p
DEFINE VARIABLE i AS INTEGER NO-UNDO. 
FORM WITH FRAME bbb. 
REPEAT WITH FRAME bbb: 
   PROMPT-FOR customer.cust-num WITH FRAME aaa. 
   FIND customer USING cust-num NO-LOCK NO-ERROR. 
   IF ERROR-STATUS:ERROR THEN DO: 
     MESSAGE ERROR-STATUS:NUM-MESSAGES 
         " errors occurred during conversion." SKIP 
         "Do you want to view them?" 
       VIEW-AS ALERT-BOX QUESTION BUTTONS YES-NO 
       UPDATE view-errs AS LOGICAL. 
     IF view-errs THEN 
       DO i = 1 TO ERROR-STATUS:NUM-MESSAGES: 
         MESSAGE ERROR-STATUS:GET-NUMBER(i) 
                 ERROR-STATUS:GET-MESSAGE(i). 
       END. 
     END. 
     ELSE 
       DISPLAY customer WITH 2 COLUMNS. 
END. 


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