Informix Error -4162: Values cannot be RETURNed from within reports.
Cause and resolution
Values cannot be RETURNed from within reports.
A report cannot include a RETURN statement because that would return control to the routine that invoked the report.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4162 fires when a report includes a RETURN statement — per the official guidance, a
RETURN inside a report would return control to the routine that invoked the report, which
isn't supported.
- A
RETURNstatement inside a report's body, per the official guidance — the direct, only cause.
Solutions / Resolution
- Remove the
RETURNstatement from the report.
Examples
A RETURN inside a report
REPORT order_report(rec)
DEFINE rec RECORD LIKE orders.*
OUTPUT
...
FORMAT
ON EVERY ROW
PRINT rec.order_id
RETURN
-- -4162: RETURN is not allowed inside a report
END FORMAT
END REPORT
Corrected
REPORT order_report(rec)
...
FORMAT
ON EVERY ROW
PRINT rec.order_id
END FORMAT
END REPORT
Diagnostic Checks
- Check every report's body for a
RETURNstatement, and remove it.
Related Errors / Related Topics
- -4121 — "Reports cannot be invoked through the CALL statement or in function call expressions." A related report-usage restriction, about how a report is invoked rather than what statements can appear inside it.
A report includes a RETURN statement, which isn't allowed — remove it.