Informix Error -4342
-4342 PAGENO and LINENO are allowed only in reports.
These functions are only relevant in the body of a report function (one following a REPORT statement). Only within the report-generating code is the idea of a current page or line meaningful. You can make these values available outside a report through global variables. For example, you could put a statement such as this one in the PAGE HEADER control block:
LET CURR_PAGE = PAGENO
This would assign the current page to a global variable (called CURR_PAGE in the example) that could be tested by code outside the report function.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4342 fires when PAGENO/LINENO is used outside a report function's body — per the official
guidance, only within report-generating code is the idea of a current page or line meaningful.
PAGENO/LINENOused outside a report function, per the official guidance — the direct, only cause.
Solutions / Resolution
- Make the value available outside the report via a global variable, per the official
guidance — for example,
LET CURR_PAGE = PAGENOinside aPAGE HEADERcontrol block, then readCURR_PAGEfrom code outside the report.
Examples
Using PAGENO outside a report
DISPLAY "Current page: ", PAGENO
-- -4342: PAGENO is only meaningful inside a report
Corrected
REPORT myreport()
...
OUTPUT
PAGE HEADER
LET CURR_PAGE = PAGENO
END REPORT
...
DISPLAY "Current page: ", CURR_PAGE
Diagnostic Checks
- Check whether
PAGENO/LINENOis used inside a report function, and if the value is needed elsewhere, capture it into a global variable from within the report first.
Related Errors / Related Topics
No closely related error codes are cross-referenced for -4342 in this set yet.
PAGENO/LINENO is used outside a report — capture the value into a global variable from
within the report instead.