Compaq COBOL AAQ2G1FTK User Manual

Page 338

Advertising
background image

Producing Printed Reports
10.8 Programming a Report Writer Report

With the GROUP INDICATE clause, the program produces the following output:

1

2

3

123456789012345678901234567890
Name

Registration
Number

Rolans

R.

123456
123457
123458

Vencher R.

654321
654322
654323
654324

Anders J.

987654
987655
987656

10.8.13 Processing a Report Writer Report

In a Report Writer program, you usually use the following five statements:

INITIATE

GENERATE

TERMINATE

USE BEFORE REPORTING

SUPPRESS

You must use the INITIATE, GENERATE, and TERMINATE statements. The
USE BEFORE REPORTING and the SUPPRESS statements are optional.

Before any Report Writer statement is executed, the report file must be open.

10.8.13.1 Initiating the Report

The INITIATE statement begins the report processing and is executed before
any GENERATE or TERMINATE statements. The report name used in this
statement is specified in the RD entry in the Report Section and in the REPORT
clause of the FD entry for the file to which the report is written.

INITIATE sets PAGE-COUNTER to 1, LINE-COUNTER to zero, and all SUM
counters to zero.

This program code uses the code in Section 10.8.2.

PROCEDURE DIVISION.

.
.
.

MAIN SECTION.
000-START.

OPEN INPUT CUSTOMER-FILE.
OPEN OUTPUT PRINTER-FILE.
.
.
.
INITIATE MASTER-LIST.

A second INITIATE statement for the same report must not be executed until a
TERMINATE statement for the report has been executed (see Section 10.8.13.4).

10–38 Producing Printed Reports

Advertising