Compaq COBOL AAQ2G1FTK User Manual

Page 332

Advertising
background image

Producing Printed Reports
10.8 Programming a Report Writer Report

You can also code a SOURCE clause with PAGE-COUNTER or LINE-COUNTER
as its operand, as the following example shows. PAGE-COUNTER references
a special register created by the compiler for each Report Description entry in
the Report Section. This counter automatically increments by 1 each time the
Report Writer executes a page advance. The use of PAGE-COUNTER eliminates
Procedure Division statements you normally would write to explicitly count pages,
as shown in the following example:

01

TYPE IS PAGE HEADING.
02

LINE 5.
03

COLUMN 1
PIC X(27) VALUE "CUSTOMER MASTER FILE REPORT".

03

COLUMN 52
PIC X(4)

VALUE "PAGE".

03

COLUMN 57
PIC ZZZ9
SOURCE PAGE-COUNTER.

This example produces the following output:

1

2

3

4

5

6

column 123456789012345678901234567890123456789012345678901234567890

CUSTOMER MASTER FILE REPORT

PAGE

9

10.8.9 Specifying Multiple Reports

To include two or more reports in one file, you specify multiple identifiers in the
REPORTS clause and provide multiple RDs in the Report Section.

To identify the lines of two or more reports in one file, you use the CODE clause,
as shown in the following example:

FILE SECTION.
FD

REPORT-FILE
REPORTS ARE REPORT1

REPORT2
REPORT3.

REPORT SECTION.
RD

REPORT1...
CODE"AA".

RD

REPORT2...
CODE"BB".

RD

REPORT3...
CODE"CC".

The CODE clause specifies a 2-character nonnumeric literal that identifies each
print line as belonging to a specific report. When the CODE clause is specified,
the literal is automatically placed in the first two character positions of each
Report Writer logical record. Note that if the clause is specified for any report in
a file, it must be used for all reports in that file.

10.8.10 Generating and Controlling Report Headings and Footings

When you write a report that has control headings and/or footings, you must use
the CONTROL clause to create control levels that determine subsequent headings
and totals.

The CONTROL clause, found in the RD entry, names data items that indicate
when control breaks occur. The CONTROL clause specifies the data items in
major to minor order. You must define these CONTROL data items, or control
names, in the Data Division, and reference them in the appropriate CONTROL
HEADING and FOOTING report groups.

10–32 Producing Printed Reports

Advertising