Informix Error -4317
-4317 The program cannot exit a FOR statement at this point because
it is not within a FOR statement.This CONTINUE or EXIT statement uses the FOR keyword, but it is not located within a FOR loop. Either the statement is in error, or some other error has prevented 4GL from recognizing the FOR statement.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4317 fires when CONTINUE FOR or EXIT FOR appears outside a FOR loop — per the official
guidance, either the statement is misplaced, or some other error prevented 4GL from
recognizing the enclosing FOR statement.
CONTINUE FOR/EXIT FORused outside aFORloop, per the official guidance — the direct cause.- A separate error prevented the enclosing
FORstatement from being recognized, per the official guidance — a related possible cause.
Solutions / Resolution
- Move the
CONTINUE FOR/EXIT FORstatement inside aFORloop, or - Check for other errors preventing the
FORstatement from being recognized, per the official guidance.
Examples
EXIT FOR outside a FOR loop
FUNCTION process()
EXIT FOR
-- -4317: not inside a FOR loop
END FUNCTION
Corrected
FOR i = 1 TO 10
IF condition THEN
EXIT FOR
END IF
END FOR
Diagnostic Checks
- Check whether the
CONTINUE FOR/EXIT FORstatement is inside aFORloop, and check for other errors affecting the enclosingFORstatement 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 ofFOR. - -4316 — "The program cannot exit a WHILE statement at this point because it is not
within a WHILE statement." The same pattern applied to
WHILEinstead ofFOR.
CONTINUE FOR/EXIT FOR is used outside a FOR loop — move it inside, or check for errors
affecting the FOR statement's recognition.