Informix Error -4316
-4316 The program cannot exit a WHILE statement at this point because
it is not within a WHILE statement.This CONTINUE or EXIT statement uses the WHILE keyword, but it is not located within a WHILE loop. Either the statement is in error, or some other error has prevented 4GL from recognizing the WHILE statement.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4316 fires when CONTINUE WHILE or EXIT WHILE appears outside a WHILE loop — per the
official guidance, either the statement is misplaced, or some other error prevented 4GL from
recognizing the enclosing WHILE statement.
CONTINUE WHILE/EXIT WHILEused outside aWHILEloop, per the official guidance — the direct cause.- A separate error prevented the enclosing
WHILEstatement from being recognized, per the official guidance — a related possible cause.
Solutions / Resolution
- Move the
CONTINUE WHILE/EXIT WHILEstatement inside aWHILEloop, or - Check for other errors preventing the
WHILEstatement from being recognized, per the official guidance.
Examples
EXIT WHILE outside a WHILE loop
FUNCTION process()
EXIT WHILE
-- -4316: not inside a WHILE loop
END FUNCTION
Corrected
WHILE more_rows
IF done THEN
EXIT WHILE
END IF
END WHILE
Diagnostic Checks
- Check whether the
CONTINUE WHILE/EXIT WHILEstatement is inside aWHILEloop, and check for other errors affecting the enclosingWHILEstatement if it should be.
Related Errors / Related Topics
- -4314 — "The program cannot continue or exit a menu at this point because it is not
within a MENU statement." The same pattern applied to
MENUinstead ofWHILE. - -4315 — "The program cannot exit a FOREACH statement at this point because it is not
within a FOREACH statement." The same pattern applied to
FOREACHinstead ofWHILE.
CONTINUE WHILE/EXIT WHILE is used outside a WHILE loop — move it inside, or check for
errors affecting the WHILE statement's recognition.