Try OpenEdge Now
skip to main content
Error Handling
ABL Block Essentials : Branching options
 

Branching options

After a block performs its undo operation, the AVM must determine what action to take next. ABL has the following set of branching options (flow of control options) as defined below:
*RETRY — If a block contains user input logic, the RETRY action repeats the iteration of the block. RETRY is useful when you want to give your users another chance to input correct data. Since good modern programming practice recommends separating user interface logic from transaction logic, RETRY is not normally used.
*LEAVE — Indicates that the AVM should exit the block and resume execution with the next statement.
*NEXT — Indicates that the AVM should exit the current iteration of a block and continue with the next iteration. If there is not another iteration to do, then NEXT is the same as LEAVE
*RETURN — Indicates that the AVM should exit the block and immediately exit the current routine. Execution resumes in the caller. If no caller exists, then the application quits. RETURN has many options itself and is fully discussed in Traditional Error Handling
*THROW — (Structured error handling) Indicates that the AVM should suppress the default error message, exit the block, and pass an error object to the caller or the next enclosing block.
Each block type has default branching behavior. The following table lists the default action by block type and by context.
Table 2. Default branching on error
Block Type
If user input detected
If iterating
Otherwise
DO TRANSACTION
RETRY
NEXT
LEAVE
FOR
RETRY
NEXT
REPEAT
RETRY
NEXT
LEAVE
End blocks
THROW
Routine-level blocks
RETRY
LEAVE
Trigger procedure file
RETRY
RETURN ERROR