10.14.11 Return From a Procedure (RETURN)

Syntax

RETURN ;

Purpose

The RETURN statement is used to exit from a procedure before the last statement of the procedure is reached. Under normal circumstances, a return is done at the end of a procedure. The RETURN statement allows for an early exit.

Example:

PROCEDURE print_overdue

BEGIN

IF last_paydate GE $AGEDATE - 30 THEN

RETURN; /* payment not late */

PRINT "overdue"

/* ... */

END

Notes

If the RETURN statement is in the MAIN procedure, the report is terminated prematurely. If a break point has been set for the end of the report, that code is executed. If a break point has been set for the end of the page, that code is executed. After these two break points have been processed, all locked files are unlocked, all files are closed, and the report program ends.