beautypg.com

Compaq COBOL AAQ2G1FTK User Manual

Page 322

background image

Producing Printed Reports
10.6 Programming a Linage-File Compaq COBOL Report

Example 10–5 Programming a 20-Line Logical Page Defined by the LINAGE

Clause with Automatic Page Overflow

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

SELECT INPUT-FILE

ASSIGN TO "REPIN.DAT".

SELECT MINIF1-REPORT ASSIGN TO "MINIF1.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

MINIF1-REPORT
LINAGE IS 13 LINES

LINES AT TOP

2

LINES AT BOTTOM 5.

01

MINIF1-PRINT-LINE

PIC X(80).

WORKING-STORAGE SECTION.
01

END-OF-FILE

PIC

X

VALUE SPACE.

01

LINE-UP-OK

PIC

X

VALUE SPACE.

01

MINIF1-LINE-3.
02

FILLER

PIC X(9)

VALUE SPACES.

02

MINIF1-LAST

PIC X(15).

02

FILLER

PIC X(23)

VALUE SPACES.

02

FILLER

PIC X(6)

VALUE "Date: ".

02

MINIF1-DATE

PIC 99/99/99.

01

MINIF1-LINE-13.
02

FILLER

PIC X(4)

VALUE SPACES.

02

MINIF1-NAME

PIC X(26).

01

MINIF1-LINE-14.
02

FILLER

PIC X(4)

VALUE SPACES.

02

MINIF1-STREET

PIC X(20).

01

MINIF1-LINE-15.
02

FILLER

PIC X(4)

VALUE SPACES.

02

MINIF1-CITY

PIC X(15).

02

FILLER

PIC X

VALUE SPACE.

02

MINIF1-STATE

PIC XX.

02

FILLER

PIC X

VALUE SPACE.

02

MINIF1-ZIP

PIC 99999.

PROCEDURE DIVISION.
A000-BEGIN.

OPEN OUTPUT MINIF1-REPORT.
ACCEPT MINIF1-DATE FROM DATE.
PERFORM A300-FORM-LINE-UP UNTIL LINE-UP-OK = "Y".
OPEN INPUT

INPUT-FILE.

PERFORM A100-READ-INPUT UNTIL END-OF-FILE = "Y".

A010-WRAP-UP.

CLOSE INPUT-FILE

MINIF1-REPORT.

DISPLAY "END OF JOB".
STOP RUN.

(continued on next page)

10–22 Producing Printed Reports