beautypg.com

Compaq COBOL AAQ2G1FTK User Manual

Page 337

background image

Producing Printed Reports

10.8 Programming a Report Writer Report

In the preceding example, the value of ADD-COUNTER is added to the
CONTROL FOOTING FINAL counter every time the FIRST-DETAIL-LINE
report group is generated.

10.8.12 Restricting Print Items

In a Report Writer program, the GROUP INDICATE clause eliminates repeated
information from report detail lines by allowing an elementary item in a DETAIL
report group to be printed only the first time after a control or page break. The
following example illustrates the use of this clause:

01

DETAIL-LINE TYPE DETAIL LINE PLUS 1.

05

COLUMN 1 GROUP INDICATE PIC X(6) VALUE "SALES:".

*

(prints only the first time after a control or page break)

05

COLUMN 10 PIC X(10) SOURCE BRANCH.

*

(prints each time)

These statements produce the following lines:

SALES:

BRANCH-A

BRANCH-B

BRANCH-C

The next two examples are nearly identical programs; the only difference is the
use of the GROUP INDICATE clause in the second example.

The following program does not contain a GROUP INDICATE clause:

01

DETAIL-LINE TYPE IS DETAIL

LINE IS PLUS 1.

02

COLUMN 1

PIC X(15)

SOURCE A-NAME.

02

COLUMN 20 PIC 9(6)

SOURCE A-REG-NO.

It produces the following output:

1

2

3

123456789012345678901234567890
Name

Registration
Number

Rolans

R.

123456

Rolans

R.

123457

Rolans

R.

123458

Vencher R.

654321

Vencher R.

654322

Vencher R.

654323

Vencher R.

654324

Anders J.

987654

Anders J.

987655

Anders J.

987656

The following example contains a GROUP INDICATE clause:

01

DETAIL-LINE TYPE IS DETAIL

LINE IS PLUS 1.

02

COLUMN 1

PIC X(15)

SOURCE A-NAME
GROUP INDICATE.

02

COLUMN 20

PIC 9(6)

SOURCE A-REG-NO.

Producing Printed Reports 10–37