beautypg.com

Compaq COBOL AAQ2G1FTK User Manual

Page 309

background image

Producing Printed Reports

10.5 Programming a Conventional File Report

10.5.4 Printing the Conventional Report

When you are ready to print your report, you must ensure that your system’s line
printer can accommodate the page size or form of your report. If the printer uses
a different page size or form, contact your system manager. The system manager
can change the page or form size to accommodate your report.

Section 10.7 describes the different modes for printing a report.

10.5.5 A Conventional File Report Example

Example 10–3 shows a Compaq COBOL program that produces two reports from
the same input file.

Example 10–3 Page Advancing and Line Skipping

IDENTIFICATION DIVISION.
PROGRAM-ID. REP01.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.

SELECT INPUT-FILE

ASSIGN TO "REPIN.DAT".

SELECT FORM1-REPORT ASSIGN TO "FORM1.DAT".
SELECT FORM2-REPORT ASSIGN TO "FORM2.DAT".

DATA DIVISION.
FILE SECTION.
FD

INPUT-FILE.

01

INPUT-RECORD.
02

I-NAME.
03

I-FIRST

PIC X(10).

03

I-MID

PIC X.

03

I-LAST

PIC X(15).

02

I-ADDRESS.
03

I-STREET

PIC X(20).

03

I-CITY

PIC X(15).

03

I-STATE

PIC XX.

03

I-ZIP

PIC 99999.

FD

FORM1-REPORT.

01

FORM1-PRINT-LINE

PIC X(80).

FD

FORM2-REPORT.

01

FORM2-PRINT-LINE

PIC X(80).

WORKING-STORAGE SECTION.
01

END-OF-FILE

PIC

X

VALUE SPACE.

01

MAX-LINES-ON-FORM2

PIC

99

VALUE 55.

01

FORM2-LINE-COUNTER

PIC

99

VALUE 00.

01

PAGE-NO

PIC

99999 VALUE 0.

01

FORM1-LINE-3.
02

PIC X(9)

VALUE SPACES.

02

FORM1-LAST

PIC X(15).

01

FORM1-LINE-13.
02

PIC X(4)

VALUE SPACES.

02

FORM1-NAME

PIC X(26).

(continued on next page)

Producing Printed Reports 10–9