Informix Error -4428: You may not use a PROMPT statement within an INPUT or PROMPT statement, even if it is enclosed within a conditional or looping statement.
Cause and resolution
You may not use a PROMPT statement within an INPUT or PROMPT statement, even if it is enclosed within a conditional or looping statement.
You can execute a PROMPT statement from within another one or from within an INPUT statement, but in order to do so you must place the PROMPT statement in a function and call the function. You cannot embed the text of a PROMPT statement within an INPUT statement or another PROMPT.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4428 fires when a PROMPT statement's text is embedded directly inside an INPUT or another
PROMPT statement — per the official guidance, executing one from within another is possible,
but only by placing the inner statement in its own function and calling that function.
PROMPTstatement text embedded directly insideINPUT/PROMPT, per the official guidance — the direct, only cause.
Solutions / Resolution
- Place the inner
PROMPTstatement in its own function, and call that function from within the outerINPUT/PROMPT, per the official guidance.
Examples
An embedded PROMPT statement
INPUT BY NAME rec.*
ON KEY(F3)
PROMPT "Confirm? (y/n): " FOR response
-- -4428: PROMPT cannot be embedded directly inside INPUT
END INPUT
Corrected
FUNCTION confirmPrompt()
PROMPT "Confirm? (y/n): " FOR response
END FUNCTION
INPUT BY NAME rec.*
ON KEY(F3)
CALL confirmPrompt()
END INPUT
Diagnostic Checks
- Check every
INPUT/PROMPTstatement for anotherPROMPTembedded directly inside it, and move the inner one into its own function.
Related Errors / Related Topics
- -4421 — "You may not use an INPUT statement within another INPUT statement or PROMPT
statement, even if it is enclosed within a conditional or looping statement." The same
embedding restriction applied to
INPUTinsideINPUT/PROMPT. - -4422 — "You may not use a CONSTRUCT statement within another INPUT statement." The
same embedding restriction applied to
CONSTRUCTinsideINPUT.
PROMPT is embedded directly inside INPUT/PROMPT — move it into its own function and call
that function instead.