beautypg.com

Compaq COBOL AAQ2G1FTK User Manual

Page 342

background image

Producing Printed Reports
10.8 Programming a Report Writer Report

The following example indicates that the phrase BEGINNING-OF-REPORT
is to be displayed just before the REPORT HEADING group named REPORT-
HEADER; the phrase END-OF-REPORT is to be displayed just before the
REPORT FOOTING group called REPORT-FOOTER.

PROCEDURE DIVISION.
DECLARATIVES.
BOR SECTION.

USE BEFORE REPORTING REPORT-HEADER.

BOR-A.

DISPLAY "BEGINNING-OF-REPORT".

EOR SECTION.

USE BEFORE REPORTING REPORT-FOOTER.

EOR-A.

DISPLAY "END-OF-REPORT".

END DECLARATIVES.

Note that you cannot use INITIATE, GENERATE, or TERMINATE in a
Declarative procedure.

10.8.13.6 Suppressing a Report Group

You can also use the SUPPRESS statement in a USE BEFORE REPORTING
procedure to suppress the printing of a report group. For example, you can
suppress printing of an unnecessary total line, such as a line for a monthly sales
total that has only one sale or a line of zeros.

The SUPPRESS statement nullifies any NEXT GROUP and LINE clauses, but
leaves the LINE-COUNTER value unchanged.

Note that the SUPPRESS statement applies only to that particular instance of
the report group; that group will be printed the next time unless the SUPPRESS
statement is executed again.

The SUPPRESS statement has no effect on sum counters.

10.8.14 Selecting a Report Writer Report Type

You can print two types of reports using the Report Writer feature. In a detail
report, you print primary data information as well as totals. In a summary
report, you print only control heading and footing information (such as report
data headings and totals) and exclude detail input record information.

Section 10.9 provides examples of detail and summary reports.

10.8.14.1 Detail Reporting

In detail reporting, at least one printable TYPE DETAIL report group must be
specified. A GENERATE statement produces the specified TYPE DETAIL report
group and performs all the automatic operations of the Report Writer facility as
specified in the report group entries (see Section 10.8.13.3).

In the following example, DETAIL-LINE is the name of the DETAIL report group.
When this GENERATE statement executes, a detail report is printed.

200-READ-MASTER.

READ CUSTOMER-FILE AT END MOVE HIGH-VALUES TO NAME.
IF NAME NOT = HIGH-VALUES GENERATE DETAIL-LINE.

10–42 Producing Printed Reports