Try OpenEdge Now
skip to main content
Error Handling
ABL Block Essentials : The UNDO statement
 

The UNDO statement

You might also want to undo a transaction if your business logic detects errors other than database errors. The UNDO statement allows you to undo the current transaction and specify a branching action. This is the syntax for the UNDO statement:

Syntax

UNDO
[ label ]
[ , LEAVE [ label2 ]
| , NEXT [ label2 ]
| , RETRY [ label1 ]
      | , RETURN [return-value |                  
ERROR [return-value |error-object-expression]|
                  NO-APPLY ]
      |  , THROW error-object-expression
]
Notice the label syntax. If your block header statements define labels for your blocks, then you can use those labels to control which block gets undone or which block to perform a LEAVE or NEXT branch to. Labels let you control how much of the transaction to undo when you are working with nested blocks.
Note: If you use the LEAVE label2 or NEXT label2 option, label2 cannot be a block outside the scope of the UNDO.
The remaining UNDO options will be covered in TraditionalError Handling