After a block performs its UNDO operation, the AVM must determine what action to take next. ABL has the following set of branching (flow of control) options:

  • RETRY — If a block is an iterating block, 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.
  • 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, 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 terminates. The RETURN statement has many options and is discussed from an error handling perspective in RETURN ERROR.
  • THROW — Indicates that the AVM should capture any error message in an error or stop object, exit the block, and raise the same condition again in the next enclosing block, if there is one, otherwise in the caller. The thrown object is then available in the outer block to be handled there.

Each block type has default branching behavior. The following table lists the default action by block type and by context.

Table 1. Default branching for ERROR conditions
Block Type Action if user input detected Action otherwise
DO TRANSACTION RETRY LEAVE
FOR EACH RETRY NEXT
REPEAT RETRY LEAVE
CATCH THROW THROW
FINALLY THROW THROW
Routine-level blocks (for example, procedures, methods) RETRY LEAVE
Trigger procedure file RETURN ERROR RETURN ERROR
Table 2. Default branching for STOP conditions
Block Type Action
DO TRANSACTION LEAVE
FOR EACH LEAVE
REPEAT LEAVE
CATCH LEAVE
FINALLY LEAVE
Routine-level blocks (for example, procedures, methods) LEAVE
Trigger procedure file LEAVE

For STOP conditions, the block action is to leave, but the condition is raised again in the outer, or calling block, by default. Even though the condition is raised again, this is not the same thing as a THROW. With THROW, the error message is trapped in an object and is only displayed if you catch it and display the message itself, or if the error raised at the outer/upper level is not handled or thrown again. It is not displayed at the statement where the error occurred. For STOP, the default is to display any error message immediately, leave the block, and raise the condition again in the outer/upper block. The message is only displayed once at the place where the STOP condition occurred.