FINISH REPORT

The FINISH REPORT statement completes processing of a 4GL report.

4GLREF00000142.gif

report is the name of a 4GL report, as declared in the REPORT statement.

You can use the FINISH REPORT statement to indicate the end of a report driver and to complete processing of the report. FINISH REPORT must follow a START REPORT statement, and at least one OUTPUT TO REPORT statement, that reference the same report.

If the REPORT definition includes an ORDER BY section with no EXTERNAL keyword, or specifies aggregates based on all the input records, 4GL makes two passes through the input records. During the first pass, it uses the database engine to sort the data, and then stores the sorted values in a temporary file. During the second pass, it calculates any aggregate values, and produces output from data in the temporary files.

Executing the FINISH REPORT statement performs the following actions:

Completes the second pass, if report is a two-pass report. These second pass activities handle the calculation and output of any aggregate values that are based on all the input records in the report, such as COUNT(*) or PERCENT(*) with no GROUP qualifier.

Executes any AFTER GROUP OF control blocks.

Executes any PAGE HEADER, ON LAST ROW, and PAGE TRAILER control blocks needed to complete the report.

Copies any data from the output buffers of the report to what START REPORT or the report definition specified as the destination. If none was specified, output goes to the Report window.

Closes the Select cursor on any temporary table that was created to order the input records or to perform aggregate calculations.

Deallocates memory for any local BYTE or TEXT variables in the report.

Terminates processing of the 4GL report, and deletes from the database any files that held temporary tables for a two-pass report.

References

DATABASE

OUTPUT TO REPORT

REPORT

START REPORT