UNDO and scope using NO-ERROR
- Last Updated: March 30, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
NO-ERROR is a statement-based construct. If the
statement where NO-ERROR is used can update database
fields or undoable program variables (for example, the ASSIGN statement), the AVM creates a subtransaction around the statement.
This means that any modifications that occur before the error happens are undone. In
this scenario, if the statement includes an expression that contains other executable
elements, like method calls, the undoable operations performed by these elements are
also undone, since they are part of the subtransaction.
On the other hand, if the statement itself cannot make any updates to database
fields or undoable program variables, the AVM does not start a subtransaction. For
example, specifying the NO-ERROR option on a RUN statement does not have any effect on whether
statements inside the procedure are undone; that is controlled by constructs inside the
procedure itself.
Similarly, the scope of the NO-ERROR option is
only the current statement. It only traps information on an error that is raised to the
level of that statement. It has no effect, in terms of error message suppression, on
statements in sub-blocks that may be invoked by the statement. For example, the FIND statement in the following code displays an error to
the current output device. It is not trapped by the NO-ERROR option on the RUN statement.
|