Producing Printed Reports
10.9 Report Writer Examples
Example 10–8 Sample Program EX1008
IDENTIFICATION DIVISION.
PROGRAM-ID. EX1008.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT CUSTOMER-FILE ASSIGN TO "MASTER.DAT".
SELECT SORT-FILE
ASSIGN TO "EX1008-SORTIN.TMP".
SELECT SORTED-FILE
ASSIGN TO "EX1008-SORTOUT.TMP".
SELECT PRINTER-FILE
ASSIGN TO "EX1008.LIS".
DATA DIVISION.
FILE SECTION.
SD
SORT-FILE.
01
SORTED-CUSTOMER-MASTER-FILE.
02
SORT-NAME
PIC X(26).
02
PIC X(73).
FD
CUSTOMER-FILE.
01
CUSTOMER-MASTER-FILE
PIC X(99).
FD
SORTED-FILE.
01
SORTED-RECORD.
02
SORTED-NAME
PIC X(26).
02
S-ADDRESS
PIC X(20).
02
S-CITY
PIC X(20).
02
S-STATE
PIC XX.
02
S-ZIP
PIC 99999.
02
S-SALESMAN-NUMBER
PIC 99999.
03
S-INVOICE-NUMBER
PIC 999999.
03
S-INVOICE-SALES
PIC S9(5)V99.
03
S-INVOICE-DATE.
04
S-INV-DAY
PIC 99.
04
S-INV-MO
PIC 99.
04
S-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.
01
EOF
PIC X VALUE "N".
01
SAVE-INVOICE-SALES
PIC S9(9)V99 VALUE 0.
01
CUSTOMER-MASTER-RECORD.
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.
(continued on next page)
10–58 Producing Printed Reports
Содержание COBOL AAQ2G1FTK
Страница 22: ......
Страница 30: ......
Страница 94: ......
Страница 110: ......
Страница 146: ......
Страница 180: ......
Страница 194: ...Processing Files and Records 6 1 Defi...
Страница 300: ......
Страница 490: ......
Страница 516: ......
Страница 517: ......
Страница 530: ......
Страница 534: ......
Страница 590: ......
Страница 620: ......