Compaq COBOL AAQ2G1FTK User Manual

Page 335

Advertising
background image

Producing Printed Reports

10.8 Programming a Report Writer Report

10.8.11.2 Crossfooting

In crossfooting, the SUM clause adds all the sum counters in the same CONTROL
FOOTING report group and automatically creates another sum counter.

In the following example, the CONTROL FOOTING group shows both subtotaling
(SALES-1) and crossfooting (SALES-2):

01

TYPE DETAIL LINE PLUS 1.
05

COLUMN 15 PIC 999.99 SOURCE BRANCH1-SALES.

05

COLUMN 25 PIC 999.99 SOURCE BRANCH2-SALES.

01

TYPE CONTROL FOOTING BRANCH-TOTAL LINE PLUS 2.
05

SALES-1

COLUMN 15 PIC 999.99 SUM BRANCH1-SALES.

05

SALES-2

COLUMN 25 PIC 999.99 SUM BRANCH2-SALES.

05

SALES-TOT

COLUMN 50 PIC 999.99 SUM SALES-1, SALES-2.

The SALES-1 sum contains the total of the BRANCH1-SALES column and the
SALES-2 sum contains the total of the BRANCH2-SALES column (both sums
are subtotals). SALES-TOT contains the sum of SALES-1 and SALES-2; it is a
crossfooting.

The crossfooting ouput is as follows:

1

2

3

4

5

6

column 123456789012345678901234567890123456789012345678901234567890

125.00

300.00

425.00

10.8.11.3 Rolling Forward

When rolling totals forward, the SUM clause adds a sum counter from a lower-
level CONTROL FOOTING report group to a sum counter in a higher-level
footing group. The control logic and necessary control hierarchy for rolling
counters forward begins in the CONTROL clause.

In the following example, WEEK-AMT is a sum counter found in the lower-level
CONTROL FOOTING group, EACH-WEEK. This sum counter is named in the
SUM clause in the higher-level CONTROL FOOTING report group, EACH-
MONTH. The value of each WEEK-AMT sum is added to the higher-level counter
just before the lower-level CONTROL FOOTING group is printed.

RD

EXPENSE-FILE.
.
.
.
CONTROLS ARE EACH-MONTH, EACH-WEEK.

01

TYPE CONTROL FOOTING EACH-WEEK.
02

LINE PLUS 2.

03

COLUMN 1

PIC IS X(30)

VALUE IS

"TOTAL EXPENSES FOR WEEK/ENDING".

03

COLUMN 33

PIC IS X(9)

SOURCE IS MONTH.

03

COLUMN 42

PIC IS X(2)

SOURCE IS DAY.

03

WEEK-AMT

COLUMN 45
PIC ZZ9.99

SUM COST.

01

TYPE CONTROL FOOTING EACH-MONTH.
02

LINE PLUS 2.

03

COLUMN 10

PIC X(18)

VALUE IS "TOTAL EXPENSES FOR".

03

COLUMN 29

PIC X(9)

SOURCE MONTH.

03

COLUMN 50

PIC ZZ9.99 SUM WEEK-AMT.

The following output is a result of rolling the totals forward:

1

2

3

4

5

column 1234567890123456789012345678901234567890123456789012345

TOTAL EXPENSES FOR DECEMBER

379.19

Producing Printed Reports 10–35

Advertising