Progress
Language Reference


LINE-COUNTER Function

Interfaces
OS
SpeedScript
All
All
Yes

Returns the current line number of paged output.

The initial value of LINE-COUNTER is 1. At the completion of each DISPLAY statement, Progress increments LINE-COUNTER by the number of lines that were output in that DISPLAY statement. LINE-COUNTER continues to increase until after at least one line has been printed on a new page.

Line-COUNTER returns a 0 if the output is not paged.

SYNTAX

LINE-COUNTER [ ( stream ) ] 

stream

Specifies the name of a stream. If you do not name a stream, Progress uses the unnamed stream. For more information on streams, see this book’s DEFINE STREAM Statement reference entry and the Progress Programming Handbook chapter on alternate I/O sources.

EXAMPLE

This procedure prints a customer report, categorized by state. At the end of each state category, it tests to see if there are at least four lines left on the page. The LINE-COUNTER function returns the current line number of output. If that number plus four is greater than the total number of lines on the page (returned by the PAGE-SIZE function), then the procedure starts the new page. If there are four or more lines left, the procedure skips a line before printing the next customer record.

r-linec.p
OUTPUT TO PRINTER.
FOR EACH customer BREAK BY state:
    DISPLAY cust-num name address city state.
    IF LAST-OF(state) THEN DO:
        IF LINE-COUNTER + 4 > PAGE-SIZE
        THEN PAGE.
        ELSE DOWN 1.
    END.
END. 

NOTES

SEE ALSO

DEFINE STREAM Statement


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095