Informix Error -4047: Mixed informal and formal function declaration syntax. Return type is ignored.
Cause and resolution
Mixed informal and formal function declaration syntax. Return type is ignored.
A function declaration has blended informal (FUNCTION program block) and formal (FUNCTION prototype) syntax. The parenthesized list of arguments gave only names, with the types to be defined later in a VARIABLE statement, but the declaration then continued with a RETURNING clause, available only in the FUNCTION prototype style of declaration. Consult the IBM Informix 4GL Reference Manual.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4047 fires when a function declaration blends informal and formal syntax — per the official
guidance, the argument list gives only names (informal style, with types defined later in a
VARIABLE statement), but the declaration also continues with a RETURNING clause, which is
only valid in the formal (prototype) style.
- An argument list using informal (name-only) syntax combined with a
RETURNINGclause, per the official guidance — the direct, only cause.
Solutions / Resolution
- Consult the IBM Informix 4GL Reference Manual, per the official guidance, and use consistently formal or informal declaration syntax.
Examples
Mixed informal/formal syntax
FUNCTION save(id) RETURNING INTEGER
DEFINE id INTEGER
-- -4047: name-only argument list combined with a RETURNING clause
END FUNCTION
Corrected (formal style)
FUNCTION save(id INTEGER) RETURNING INTEGER
...
END FUNCTION
Diagnostic Checks
- Check every function declaration combining a name-only argument list with a
RETURNINGclause, and convert it fully to formal (typed-argument) syntax.
Related Errors / Related Topics
- -4046 — "Formal declaration appeared previously for this informal function definition. The formal declaration is invalidated." A related formal/informal syntax-consistency error, about a declaration/definition mismatch rather than a single declaration blending both styles.
A function declaration mixes informal and formal syntax — use one style consistently.