Informix Error -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.
Cause and resolution
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.
You can execute an INPUT statement from within another one, or from a PROMPT statement, but in order to do so you must place the INPUT statement in a function and call the function. You cannot embed the text of an INPUT statement within another.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4421 fires when an INPUT statement's text is embedded directly inside another INPUT or
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.
INPUTstatement text embedded directly inside anotherINPUT/PROMPTstatement, per the official guidance — the direct, only cause.
Solutions / Resolution
- Place the inner
INPUTstatement in its own function, and call that function from within the outerINPUT/PROMPT, per the official guidance.
Examples
An embedded INPUT statement
INPUT BY NAME rec.*
ON KEY(F1)
INPUT BY NAME other_rec.*
-- -4421: INPUT cannot be embedded directly inside another INPUT
END INPUT
END INPUT
Corrected
FUNCTION inputOther()
INPUT BY NAME other_rec.*
END INPUT
END FUNCTION
INPUT BY NAME rec.*
ON KEY(F1)
CALL inputOther()
END INPUT
Diagnostic Checks
- Check every
INPUT/PROMPTstatement for anotherINPUT/PROMPTembedded directly inside it, and move the inner one into its own function.
Related Errors / Related Topics
- -4422 — "You may not use a CONSTRUCT statement within another INPUT statement." The
same pattern applied to
CONSTRUCTembedded insideINPUT. - -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." The same pattern applied to
PROMPTembedded insideINPUT/PROMPT.
INPUT is embedded directly inside another INPUT/PROMPT — move it into its own function
and call that function instead.