LINENO operator returns the number of the line within the report page that is currently being printed.
LINENO does not take any operands:
PRINT "Page header, line number:", COLUMN 25, LINENO
LINENO returns a positive integer.
This integer is equal to the number of the current line in the report page which is being printed.
The number of the current line is calculated by counting the number of the lines from the top of the current page including the lines of the top margin.
The value returned by LINENO can be used to display data conditionally:
IF LINENO > 9 THEN
PRINT "It is in the tenth line of the report page."
END IF
You can specify LINENO in the PAGE HEADER, PAGE TRAILER, and other report control blocks of a report definition to find the print position on the current page of a report.
This example program shows how you can use LINENO for report formatting:
MAIN
DEFINE i INTEGER
START REPORT rep TO SCREEN
FOR i=1 TO 8
OUTPUT TO REPORT rep ()
END FOR
FINISH REPORT rep
END MAIN
REPORT rep ()
OUTPUT PAGE LENGTH 10
TOP MARGIN 0
BOTTOM MARGIN 0
FORMAT
PAGE HEADER
PRINT "Page header, line number:", COLUMN 25, LINENO
ON EVERY ROW
PRINT "This is line number:", COLUMN 25, LINENO
PAGE TRAILER
PRINT "Page trailer, line number:", COLUMN 25, LINENO
END REPORT
4gl cannot evaluate the LINENO operator outside the FORMAT section of a REPORT program block.
If you to use its returned results in other program blocks, you must assign them to a variable that is not local to the report.