Assigning A Value In A Print Line; Defining The Source For A Print Field - Compaq COBOL AAQ2G1FTK User Manual

Compaq computer accessories user manual
Table of Contents

Advertisement

In the next example, the COLUMN NUMBER clauses are subordinate to a LINE
NUMBER clause:
02 LINE 5 ON NEXT PAGE.
03
03
03
03
03
The previous example produces the following output:
column 1234567890123456789012345678901234567890123456

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
The previous example results in the following output:
column 12345678901234567890123456789012345678901234567890
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
COLUMN 1 PIC X(12)
COLUMN 14 PIC 9999
COLUMN 18 PIC X
COLUMN 20 PIC X(15)
COLUMN 36 PIC $$$$,$$$.99 SUM TOT-PURCHS.
1
2
(Cust-Number 1234) TOTAL PURCHASES
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".
1
2
CUSTOMER MASTER FILE REPORT
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
02 COLUMN 35
PIC X(20) SOURCE ADDRESS8 COLUMN 35
Producing Printed Reports
10.8 Programming a Report Writer Report
VALUE "(Cust-Number".
SOURCE CUST-NUM.
VALUE ")".
VALUE "TOTAL PURCHASES".
3
4
$1,432.99
3
4
SALES
SOURCE MIDDLE-INIT.
5
PIC X(207 SOURCE A

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COBOL AAQ2G1FTK and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents