Informix Error -4318
-4318 The program cannot exit a CASE statement at this point because
it is not within a CASE statement.This CONTINUE or EXIT statement uses the CASE keyword, but it is not located within a CASE statement. Either the statement is in error, or some other error has prevented 4GL from recognizing the CASE statement.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4318 fires when CONTINUE CASE or EXIT CASE appears outside a CASE statement — per the
official guidance, either the statement is misplaced, or some other error prevented 4GL from
recognizing the enclosing CASE statement.
CONTINUE CASE/EXIT CASEused outside aCASEstatement, per the official guidance — the direct cause.- A separate error prevented the enclosing
CASEstatement from being recognized, per the official guidance — a related possible cause.
Solutions / Resolution
- Move the
CONTINUE CASE/EXIT CASEstatement inside aCASEstatement, or - Check for other errors preventing the
CASEstatement from being recognized, per the official guidance.
Examples
EXIT CASE outside a CASE statement
FUNCTION process()
EXIT CASE
-- -4318: not inside a CASE statement
END FUNCTION
Corrected
CASE status
WHEN "New"
EXIT CASE
END CASE
Diagnostic Checks
- Check whether the
CONTINUE CASE/EXIT CASEstatement is inside aCASEstatement, and check for other errors affecting the enclosingCASEstatement 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 ofCASE. - -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 ofCASE. - -4317 — "The program cannot exit a FOR statement at this point because it is not within
a FOR statement." The same pattern applied to
FORinstead ofCASE.
CONTINUE CASE/EXIT CASE is used outside a CASE statement — move it inside, or check for
errors affecting the CASE statement's recognition.