Informix Error -4422: You may not use a CONSTRUCT statement within another INPUT statement. This includes situations when CONSTRUCT is enclosed within a conditional or looping statement. You must call a function that executes the CONSTRUCT statement.
Cause and resolution
You may not use a CONSTRUCT statement within another INPUT statement. This includes situations when CONSTRUCT is enclosed within a conditional or looping statement. You must call a function that executes the CONSTRUCT statement.
You can execute a CONSTRUCT statement from within an INPUT statement, but in order to do so you must place the CONSTRUCT statement in a function and call the function. You cannot embed the text of a CONSTRUCT statement in an INPUT statement.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4422 fires when a CONSTRUCT statement's text is embedded directly inside an INPUT
statement — per the official guidance, executing CONSTRUCT from within INPUT is possible,
but only by placing CONSTRUCT in its own function and calling that function.
CONSTRUCTstatement text embedded directly inside anINPUTstatement, per the official guidance — the direct, only cause.
Solutions / Resolution
- Place the
CONSTRUCTstatement in its own function, and call that function from within theINPUTstatement, per the official guidance.
Examples
An embedded CONSTRUCT statement
INPUT BY NAME rec.*
ON KEY(F2)
CONSTRUCT BY NAME query_clause ON order_id, order_date
-- -4422: CONSTRUCT cannot be embedded directly inside INPUT
END INPUT
Corrected
FUNCTION buildQuery()
CONSTRUCT BY NAME query_clause ON order_id, order_date
END FUNCTION
INPUT BY NAME rec.*
ON KEY(F2)
CALL buildQuery()
END INPUT
Diagnostic Checks
- Check every
INPUTstatement for aCONSTRUCTembedded directly inside it, and moveCONSTRUCTinto 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.
CONSTRUCT is embedded directly inside INPUT — move it into its own function and call that
function instead.