Compaq COBOL AAQ2G1FTK User Manual

Page 331

Advertising
background image

Producing Printed Reports

10.8 Programming a Report Writer Report

In the next example, the COLUMN NUMBER clauses are subordinate to a LINE
NUMBER clause:

02

LINE 5 ON NEXT PAGE.

03

COLUMN 1

PIC X(12)

VALUE "(Cust-Number".

03

COLUMN 14 PIC 9999

SOURCE CUST-NUM.

03

COLUMN 18 PIC X

VALUE ")".

03

COLUMN 20 PIC X(15)

VALUE "TOTAL PURCHASES".

03

COLUMN 36 PIC $$$$,$$$.99 SUM TOT-PURCHS.

The previous example produces the following output:

1

2

3

4

column 1234567890123456789012345678901234567890123456

(Cust-Number 1234) TOTAL PURCHASES

$1,432.99

10.8.7 Assigning a Value in a Print Line

In a Report Writer program, one way you specify a value for an item is to use the
VALUE clause. This clause designates that the data item has a constant literal
value. You often use this clause with REPORT HEADING and PAGE HEADING
report groups, because the data in these groups is usually constant, 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 40

PIC X(5)

VALUE "SALES".

The previous example results in the following output:

1

2

3

4

5

column 12345678901234567890123456789012345678901234567890

CUSTOMER MASTER FILE REPORT

SALES

10.8.8 Defining the Source for a Print Field

To assign a variable value to an item in a Report Writer program, you use the
SOURCE clause.

The SOURCE clause, written in the Report Section, is analogous to the MOVE
statement.

The clause names a data item that is moved to a specified position on the print
line. Before an item that contains a SOURCE clause is printed, the Report Writer
moves the value in the field named in the SOURCE clause into the print line at
the print position specified by the COLUMN clause, as shown in the following
example. Any data editing specified by the PICTURE clause is performed before
the data is moved to the print line.

01

DETAIL-LINE
TYPE DETAIL
LINE PLUS 1.
02 COLUMN 1

PIC X(15) SOURCE LAST-NAME.

02 COLUMN 17

PIC X(10) SOURCE FIRST-NAME.

02 COLUMN 28

PIC XX

SOURCE MIDDLE-INIT.

02 COLUMN 35

PIC X(20) SOURCE ADDRESS8 COLUMN 35

PIC X(207 SOURCE A

Advertising