NEED

Specifies the number of rows needed in a report section.

Syntax

NEED num-lines LINE[S]
  1. num-lines is the number of lines.

Usage

This statement has the effect of a conditional SKIP TO TOP OF PAGE statement, the condition being that the number to which the integer expression evaluates is greater than the number of lines that remain on the current page.

The NEED statement can prevent the report from dividing parts of the output that you want to keep together on a single page. In this example, the NEED statement causes the PRINT statement to send output to the next page unless at least six lines remain on the current page:
  AFTER GROUP OF r.order_num 
    NEED 6 LINES
    PRINT " ", r.order_date, "  ", GROUP SUM(r.total_price)

The LINES value specifies how many lines must remain between the line above the current character position and the bottom margin for the next PRINT statement to produce output on the current page. If fewer than LINES remain on the page, the report engine prints both the PAGE TRAILER and the PAGE HEADER.

The NEED statement does not include the BOTTOM MARGIN value when it compares LINES to the number of lines remaining on the current page. NEED is not valid in FIRST PAGE HEADER, PAGE HEADER, or PAGE TRAILER blocks.