beautypg.com

Compaq COBOL AAQ2G1FTK User Manual

Page 345

background image

Producing Printed Reports

10.9 Report Writer Examples

Example 10–6 Sample Program EX1006

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

SELECT CUSTOMER-FILE ASSIGN TO "MASTER.DAT".
SELECT SORT-FILE

ASSIGN TO "EX1006-SORTIN.TMP".

SELECT SORTED-FILE

ASSIGN TO "EX1006-SORTOUT.TMP".

SELECT PRINTER-FILE

ASSIGN TO "EX1006.LIS".

DATA DIVISION.
FILE SECTION.
SD

SORT-FILE.

01

SORTED-CUSTOMER-MASTER-FILE.
02

SORT-NAME

PIC X(26).

02

PIC X(73).

01

CUSTOMER-MASTER-FILE

PIC X(99).

FD

SORTED-FILE.

01

CUSTOMER-MASTER-FILE.
02

NAME.

03

LAST-NAME

PIC X(15).

03

FIRST-NAME

PIC X(10).

03

MIDDLE-INIT

PIC X.

02

ADDRESS

PIC X(20).

02

CITY

PIC X(20).

02

STATE

PIC XX.

02

ZIP

PIC 99999.

02

SALESMAN-NUMBER

PIC 99999.

03

INVOICE-NUMBER

PIC 999999.

03

INVOICE-SALES

PIC S9(5)V99.

03

INVOICE-DATE.

04

INV-DAY

PIC 99.

04

INV-MO

PIC 99.

04

INV-YR

PIC 9999.

FD

PRINTER-FILE
REPORT IS MASTER-LIST.

WORKING-STORAGE SECTION.

01

UNEDITED-DATE.
02

UE-YEAR

PIC 9999.

02

UE-MONTH

PIC 99.

02

UE-DAY

PIC 99.

02

FILLER

PIC X(6).

01

ONE-COUNT

PIC 9 VALUE 1.

(continued on next page)

Producing Printed Reports 10–45