Informix Error -4489: The statement above does not allow the use of local variables or report parameters in its expressions.
Cause and resolution
The statement above does not allow the use of local variables or report parameters in its expressions.
This statement cannot refer to an argument of the function or to a variable defined in the function. It can use only variables defined at the module level (before the MAIN section) or in the GLOBALS section. In the case of OUTPUT REPORT TO, the statement takes effect during the execution of a START REPORT statement. At this time, no arguments are passed into the report description, and no report description statements are executed that could initialize a local variable. Change the statement to refer to a variable that can be initialized before the report is started.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4489 fires when a statement like OUTPUT REPORT TO refers to a local variable or report
parameter — per the official guidance, this statement can only use module-level or GLOBALS
variables, since (for OUTPUT REPORT TO specifically) it takes effect during START REPORT,
before any report parameters are passed in or local variables initialized.
- A local variable or report parameter referenced in a statement that only supports
module-level/
GLOBALSvariables, per the official guidance — the direct, only cause.
Solutions / Resolution
- Change the statement to refer to a variable that can be initialized before the report is
started, per the official guidance — a module-level or
GLOBALSvariable.
Examples
OUTPUT REPORT TO referencing a local variable
FUNCTION runReport()
DEFINE report_target CHAR(30)
LET report_target = "orders.out"
OUTPUT REPORT TO report_target
-- -4489: report_target is local, not module-level
Corrected
DEFINE report_target CHAR(30)
FUNCTION runReport()
LET report_target = "orders.out"
OUTPUT REPORT TO report_target
Diagnostic Checks
- Check the variable referenced in the flagged statement, and confirm it's defined at
module level or in
GLOBALS, not locally or as a report parameter.
Related Errors / Related Topics
No closely related error codes are cross-referenced for -4489 in this set yet.
A statement like OUTPUT REPORT TO refers to a local variable or report parameter, which
isn't supported — use a module-level or GLOBALS variable instead.