# Compaq COBOL
User Manual

Previous | Contents | Index

## 10.9.5 EX1009---Detail Report Program

Example 10-9 (EX1009) is a Report Writer program that uses the REPORT HEADING, PAGE HEADING, DETAIL, PAGE FOOTING, CONTROL FOOTING, and REPORT FOOTING report groups. The program also uses the TYPE DETAIL clause---GROUP INDICATE. The program produces a detail report---EX1009.LIS (shown in Figure 10-18).

Example 10-9 Sample Program EX1009

    IDENTIFICATION DIVISION.
    PROGRAM-ID. EX1009.
    ENVIRONMENT DIVISION.
    CONFIGURATION SECTION.
    INPUT-OUTPUT SECTION.
    FILE-CONTROL.
            SELECT CUSTOMER-FILE ASSIGN TO "MASTER.DAT".
            SELECT SORT-FILE     ASSIGN TO "EX1009-SORTIN.TMP".
            SELECT SORTED-FILE   ASSIGN TO "EX1009-SORTOUT.TMP".
            SELECT PRINTER-FILE  ASSIGN TO "EX1009.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      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.
            02  INVOICE-DATA.
                    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.
    REPORT SECTION.
    RD MASTER-LIST
            PAGE LIMIT IS 66
            HEADING       1
            FIRST DETAIL  13
            LAST DETAIL   55
            FOOTING       58
            CONTROLS ARE FINAL
                         NAME.
    01      REPORT-HEADER TYPE IS REPORT HEADING NEXT GROUP NEXT PAGE.
            02      LINE 24.
                    03      COLUMN 45
                            PIC X(31) VALUE ALL "*".
            02      LINE 25.
                    03      COLUMN 45
                            PIC X VALUE "*".
                    03      COLUMN 75
                            PIC X VALUE "*".
            02      LINE 26.
                    03      COLUMN 45
                            PIC X(31) VALUE "*    Customer Master File     *".
            02      LINE 27.
                    03      COLUMN 45
                            PIC X VALUE "*".
                    03      COLUMN 75
                            PIC X VALUE "*".
            02      LINE 28.
                    03      COLUMN 45
                            PIC X VALUE "*".
                    03      COLUMN 55
                            PIC Z9
                            SOURCE UE-DAY.
                    03      COLUMN 57
                            PIC X   VALUE "-".
                    03      COLUMN 58
                            PIC 99
                            SOURCE UE-MONTH.
                    03      COLUMN 60
                            PIC X   VALUE "-".
                    03      COLUMN 61
                            PIC 9999
                            SOURCE UE-YEAR.
                    03      COLUMN 75
                            PIC X VALUE "*".
            02      LINE 29.
                    03      COLUMN  45
                            PIC X VALUE "*".
                    03      COLUMN 75
                            PIC X VALUE "*".
            02      LINE 30.
                    03      COLUMN  45
                            PIC X(31) VALUE "*       GROUP INDICATE        *".
            02      LINE 31.
                    03      COLUMN  45
                            PIC X(31) VALUE "*     Detail Report EX1009    *".
            02      LINE 32.
                    03      COLUMN  45
                            PIC X VALUE "*".
                    03      COLUMN 75
                            PIC X VALUE "*".

            02      LINE 33.
                    03      COLUMN  45
                            PIC X VALUE "*".
                    03      COLUMN 75
                            PIC X VALUE "*".
            02      LINE 34.
                    03      COLUMN  45
                            PIC X(31) VALUE ALL "*".
    01      TYPE IS PAGE HEADING.
            02      LINE  5.
                    03      COLUMN 1
                            PIC X(27) VALUE "CUSTOMER MASTER FILE REPORT".
                    03      COLUMN 105
                            PIC X(4)  VALUE "PAGE".
                    03      COLUMN 109
                            PIC ZZZ9
                            SOURCE PAGE-COUNTER.
            02      LINE  7.
                    03      COLUMN  1
                            PIC X VALUE "+".
                    03      COLUMN 2
                            PIC X(110) VALUE ALL "-".
                    03      COLUMN 112
                            PIC X VALUE "+".
            02      LINE  8.
                    03      COLUMN  1
                            PIC X VALUE "|".
                    03      COLUMN 10
                            PIC X(4) VALUE "NAME".
                    03      COLUMN  29
                            PIC X VALUE "|".
                    03      COLUMN 43
                            PIC X(7) VALUE "ADDRESS".
                    03      COLUMN  81
                            PIC X VALUE "|".
                    03      COLUMN  91
                            PIC X(7) VALUE "INVOICE".
                    03      COLUMN 112
                            PIC X VALUE "|".
            02      LINE  9.
                    03      COLUMN  1
                            PIC X VALUE "|".
                    03      COLUMN 2
                            PIC X(110) VALUE ALL "-".
                    03      COLUMN 112
                            PIC X VALUE "|".
            02      LINE  10.
                    03      COLUMN  1
                            PIC X(6) VALUE "| LAST".
                    03      COLUMN 16
                            PIC X(7) VALUE "| FIRST".
                    03      COLUMN 26
                            PIC X(4) VALUE "|MI|".
                    03      COLUMN  35
                            PIC X(6) VALUE "STREET".
                    03      COLUMN 48
                            PIC X VALUE "|".
                    03      COLUMN 52
                            PIC X(4) VALUE "CITY".
                    03      COLUMN  71
                            PIC X VALUE "|".
                    03      COLUMN 72
                            PIC X(2) VALUE "ST".
                    03      COLUMN 74
                            PIC X VALUE "|".
                    03      COLUMN 76
                            PIC X(3) VALUE "ZIP".
                    03      COLUMN 81
                            PIC X VALUE "|".
                    03      COLUMN 83
                            PIC X(4) VALUE "DATE".
                    03      COLUMN 90
                            PIC X VALUE "|".
                    03      COLUMN  92
                            PIC X(6) VALUE "NUMBER".
                    03      COLUMN 98
                            PIC X VALUE "|".
                    03      COLUMN 103
                            PIC X(6) VALUE "AMOUNT".
                    03      COLUMN 112
                            PIC X VALUE "|".
            02      LINE  11.
                    03      COLUMN 1
                            PIC X VALUE "+".
                    03      COLUMN 2
                            PIC X(110) VALUE ALL "-".
                    03      COLUMN 112
                            PIC X VALUE "+".
    01      DETAIL-LINE
            TYPE DETAIL
            LINE PLUS 1.
            02 COLUMN 1     PIC X(15) SOURCE LAST-NAME               GROUP INDICATE.
            02 COLUMN 17    PIC X(10) SOURCE FIRST-NAME              GROUP INDICATE.
            02 COLUMN 28    PIC XX    SOURCE MIDDLE-INIT             GROUP INDICATE.
            02 COLUMN 30    PIC X(20) SOURCE ADDRESS.
            02 COLUMN 51    PIC X(20) SOURCE CITY.
            02 COLUMN 72    PIC XX    SOURCE STATE.
            02 COLUMN 75    PIC 99999 SOURCE ZIP.
            02 COLUMN 81    PIC Z9    SOURCE INV-DAY.
            02 COLUMN 83    PIC X     VALUE "-".
            02 COLUMN 84    PIC 99    SOURCE INV-MO.
            02 COLUMN 86    PIC X     VALUE "-".
            02 COLUMN 87    PIC 9999  SOURCE INV-YR.
            02 COLUMN 92    PIC 9(6)  SOURCE INVOICE-NUMBER.
            02 COLUMN 99    PIC $$$,$$$,$$$.99-
                                      SOURCE INVOICE-SALES.
            02 DETAIL-COUNT PIC S9(10) SOURCE ONE-COUNT.
            02 INV-AMOUNT   PIC S9(9)V99 SOURCE INVOICE-SALES.

    01      PAGE-FOOTING TYPE IS PAGE FOOTING.
            02      LINE 59.
                    03      COLUMN 45
                            PIC X(16) VALUE "C O M P A N Y  ".
                    03      COLUMN  62
                            PIC X(25) VALUE  "C O N F I D E N T I A L  ".
            02      LINE 60.
                    03      COLUMN 45
                            PIC X(16) VALUE "C O M P A N Y  ".
                    03      COLUMN  62
                            PIC X(25) VALUE  "C O N F I D E N T I A L  ".

    01      TYPE IS CONTROL FOOTING NAME
                    NEXT GROUP IS PLUS 2.
            02      LINE IS PLUS 2.
                    03      COLUMN  73
                            PIC X(39) VALUE ALL "*".
            02      LINE IS PLUS 1.
                    03      COLUMN  20  PIC X(17) VALUE " TOTAL RECORDS: ".
                    03 IDC  COLUMN  40  PIC ZZZ,ZZZ,ZZ9 SUM ONE-COUNT.
                    03      COLUMN  73  PIC X(22) VALUE "*  INVOICE SUB TOTAL: ".
                    03 IIA  COLUMN  96  PIC $$$,$$$,$$$.99- SUM INVOICE-SALES.
                    03      COLUMN  111 PIC X VALUE "*".
            02      LINE IS PLUS 1.
                    03      COLUMN  73
                            PIC X(39) VALUE ALL "*".

    01      FINAL-FOOTING TYPE IS CONTROL FOOTING FINAL
                          NEXT GROUP NEXT PAGE.
            02      LINE IS PLUS 2.
                    03      COLUMN  70
                            PIC X(42) VALUE ALL "*".
            02      LINE IS PLUS 1.
                    03      COLUMN  14 PIC X(21) VALUE "GRAND TOTAL RECORDS: ".
                    03 FDC  COLUMN  40 PIC ZZZ,ZZZ,ZZ9 SUM IDC.
                    03      COLUMN  70 PIC X(24) VALUE "*  GRAND TOTAL INVOICES:".
                    03 FIA  COLUMN  94 PIC $,$$$,$$$,$$$.99- SUM IIA.
                    03      COLUMN  111 PIC X VALUE "*".
            02      LINE IS PLUS 1.
                    03      COLUMN  70
                            PIC X(42) VALUE ALL "*".

    01      REPORT-FOOTER TYPE IS REPORT FOOTING.
            02      LINE 24  ON NEXT PAGE COLUMN  45
                            PIC X(31) VALUE ALL "*".
            02      LINE 25.
                    03      COLUMN  45
                            PIC X VALUE "*".
                    03      COLUMN 75
                            PIC X VALUE "*".
            02      LINE 26.
                    03      COLUMN  45
                            PIC X(31) VALUE "*    Customer Master File     *".
            02      LINE 27.
                    03      COLUMN  45
                            PIC X VALUE "*".
                    03      COLUMN 75
                            PIC X VALUE "*".
            02      LINE 28.
                    03      COLUMN  45
                            PIC X VALUE "*".
                    03      COLUMN  55
                            PIC Z9
                            SOURCE UE-DAY.
                    03      COLUMN  57
                            PIC X   VALUE "-".
                    03      COLUMN  58
                            PIC 99
                            SOURCE UE-MONTH.
                    03      COLUMN  60
                            PIC X   VALUE "-".
                    03      COLUMN  61
                            PIC 9999
                            SOURCE UE-YEAR.
                    03      COLUMN  75
                            PIC X VALUE "*".
            02      LINE 29.
                    03      COLUMN  45
                            PIC X VALUE "*".
                    03      COLUMN 75
                            PIC X VALUE "*".
            02      LINE 30 COLUMN  45
                            PIC X(31) VALUE "*     End of Report EX1009    *".
            02      LINE 31.
                    03      COLUMN  45
                            PIC X VALUE "*".
                    03      COLUMN 75
                            PIC X VALUE "*".
            02      LINE 32 COLUMN  45
                            PIC X(31) VALUE ALL "*".
    PROCEDURE DIVISION.
    DECLARATIVES.
    BOR SECTION.
            USE BEFORE REPORTING REPORT-HEADER.
    EOR SECTION.
            USE BEFORE REPORTING REPORT-FOOTER.
    EOR-A.
            DISPLAY "*** Created EX1009.LIS ***".
    END DECLARATIVES.
    MAIN SECTION.
    000-DO-SORT.
            SORT SORT-FILE ON ASCENDING KEY SORT-NAME
                 WITH DUPLICATES IN ORDER
                 USING CUSTOMER-FILE
                 GIVING SORTED-FILE.
    000-START.
            DISPLAY "*** EX1009 ***".
            DISPLAY "Enter Current Date (YYYYMMDD) :".
            ACCEPT UNEDITED-DATE.
            OPEN INPUT  SORTED-FILE.
            OPEN OUTPUT PRINTER-FILE.
            INITIATE MASTER-LIST.
            PERFORM 200-READ-MASTER UNTIL NAME = HIGH-VALUES.
    100-END-OF-FILE.
            TERMINATE MASTER-LIST.
            CLOSE SORTED-FILE, PRINTER-FILE.
            STOP RUN.
    200-READ-MASTER.
            READ SORTED-FILE AT END MOVE HIGH-VALUES TO NAME.
            IF NAME NOT = HIGH-VALUES GENERATE DETAIL-LINE.

Figure 10-18 EX1009.LIS Listing

## 10.9.6 EX1010---Summary Report Program

Example 10-10 (EX1010) is a Report Writer program that uses the REPORT HEADING, PAGE HEADING, DETAIL, CONTROL FOOTING, PAGE FOOTING, and REPORT FOOTING report groups. The program produces a summary report---EX1010.LIS (shown in Figure 10-19)---because the GENERATE statement specifies a report name (MASTER-LIST) rather than a DETAIL report group.

Example 10-10 Sample Program EX1010

    IDENTIFICATION DIVISION.
    PROGRAM-ID. EX1010.
    ENVIRONMENT DIVISION.
    CONFIGURATION SECTION.
    INPUT-OUTPUT SECTION.
    FILE-CONTROL.
            SELECT CUSTOMER-FILE ASSIGN TO "MASTER.DAT".
            SELECT SORT-FILE     ASSIGN TO "EX1010-SORTIN.TMP".
            SELECT SORTED-FILE   ASSIGN TO "EX1010-SORTOUT.TMP".
            SELECT PRINTER-FILE  ASSIGN TO "EX1010.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      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.
            02  INVOICE-DATA.
                    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.
    REPORT SECTION.
    RD      MASTER-LIST
            PAGE LIMIT IS 66
            HEADING       1
            FIRST DETAIL  13
            LAST DETAIL   55
            FOOTING       58
            CONTROLS ARE FINAL
                        NAME.
    01      REPORT-HEADER TYPE IS REPORT HEADING NEXT GROUP NEXT PAGE.
            02      LINE 24.
                    03      COLUMN 45
                            PIC X(31) VALUE ALL "*".
            02      LINE 25.
                    03      COLUMN 45
                            PIC X VALUE "*".
                    03      COLUMN 75
                            PIC X VALUE "*".
            02      LINE 26.
                    03      COLUMN 45
                            PIC X(31) VALUE "*    Customer Master File     *".
            02      LINE 27.
                    03      COLUMN 45
                            PIC X VALUE "*".
                    03      COLUMN 75
                            PIC X VALUE "*".
            02      LINE 28.
                    03      COLUMN 45
                            PIC X VALUE "*".
                    03      COLUMN 55
                            PIC Z9
                            SOURCE UE-DAY.
                    03      COLUMN 57
                            PIC X   VALUE "-".
                    03      COLUMN 58
                            PIC 99
                            SOURCE UE-MONTH.
                    03      COLUMN 60
                            PIC X   VALUE "-".
                    03      COLUMN 61
                            PIC 9999
                            SOURCE UE-YEAR.
                    03      COLUMN 75
                            PIC X VALUE "*".
            02      LINE 29.
                    03      COLUMN  45
                            PIC X VALUE "*".
                    03      COLUMN 75
                            PIC X VALUE "*".
            02      LINE 30.
                    03      COLUMN  45
                            PIC X(31) VALUE "*       Report EX1010         *".
            02      LINE 31.
                    03      COLUMN  45
                            PIC X(31) VALUE "*       Summary Report        *".
            02      LINE 32.
                    03      COLUMN  45
                            PIC X VALUE "*".
                    03      COLUMN 75
                            PIC X VALUE "*".
            02      LINE 33.
                    03      COLUMN  45
                            PIC X VALUE "*".
                    03      COLUMN 75
                            PIC X VALUE "*".
            02      LINE 34.
                    03      COLUMN  45
                            PIC X(31) VALUE ALL "*".
    01      TYPE IS PAGE HEADING.
            02      LINE  5.
                    03      COLUMN 1
                            PIC X(27) VALUE "CUSTOMER MASTER FILE REPORT".
                    03      COLUMN 105
                            PIC X(4)  VALUE "PAGE".
                    03      COLUMN 109
                            PIC ZZZ9
                            SOURCE PAGE-COUNTER.
            02      LINE  7.
                    03      COLUMN  1
                            PIC X VALUE "+".
                    03      COLUMN 2
                            PIC X(110) VALUE ALL "-".
                    03      COLUMN 112
                            PIC X VALUE "+".
            02      LINE  8.
                    03      COLUMN  1
                            PIC X VALUE "|".
                    03      COLUMN 10
                            PIC X(4) VALUE "NAME".
                    03      COLUMN  29
                            PIC X VALUE "|".
                    03      COLUMN 43
                            PIC X(7) VALUE "ADDRESS".
                    03      COLUMN  81
                            PIC X VALUE "|".
                    03      COLUMN  91
                            PIC X(7) VALUE "INVOICE".
                    03      COLUMN 112
                            PIC X VALUE "|".
            02      LINE  9.
                    03      COLUMN  1
                            PIC X VALUE "|".
                    03      COLUMN 2
                            PIC X(110) VALUE ALL "-".
                    03      COLUMN 112
                            PIC X VALUE "|".
            02      LINE  10.
                    03      COLUMN  1
                            PIC X(6) VALUE "| LAST".
                    03      COLUMN 16
                            PIC X(7) VALUE "| FIRST".
                    03      COLUMN 26
                            PIC X(4) VALUE "|MI|".
                    03      COLUMN  35
                            PIC X(6) VALUE "STREET".
                    03      COLUMN 48
                            PIC X VALUE "|".
                    03      COLUMN 52
                            PIC X(4) VALUE "CITY".
                    03      COLUMN  71
                            PIC X VALUE "|".
                    03      COLUMN 72
                            PIC X(2) VALUE "ST".
                    03      COLUMN 74
                            PIC X VALUE "|".
                    03      COLUMN 76
                            PIC X(3) VALUE "ZIP".
                    03      COLUMN 81
                            PIC X VALUE "|".
                    03      COLUMN 83
                            PIC X(4) VALUE "DATE".
                    03      COLUMN 90
                            PIC X VALUE "|".
                    03      COLUMN  92
                            PIC X(6) VALUE "NUMBER".
                    03      COLUMN 98
                            PIC X VALUE "|".
                    03      COLUMN 103
                            PIC X(6) VALUE "AMOUNT".
                    03      COLUMN 112
                            PIC X VALUE "|".
            02      LINE  11.
                    03      COLUMN 1
                            PIC X VALUE "+".
                    03      COLUMN 2
                            PIC X(110) VALUE ALL "-".
                    03      COLUMN 112
                            PIC X VALUE "+".
    01      DETAIL-LINE
            TYPE DETAIL
            LINE PLUS 1.
            02 COLUMN 1     PIC X(15) SOURCE LAST-NAME        GROUP INDICATE.
            02 COLUMN 17    PIC X(10) SOURCE FIRST-NAME       GROUP INDICATE.
            02 COLUMN 28    PIC XX    SOURCE MIDDLE-INIT      GROUP INDICATE.
            02 COLUMN 30    PIC X(20) SOURCE ADDRESS.
            02 COLUMN 51    PIC X(20) SOURCE CITY.
            02 COLUMN 72    PIC XX    SOURCE STATE.
            02 COLUMN 75    PIC 99999 SOURCE ZIP.
            02 COLUMN 81    PIC Z9    SOURCE INV-DAY.
            02 COLUMN 83    PIC X     VALUE "-".
            02 COLUMN 84    PIC 99    SOURCE INV-MO.
            02 COLUMN 86    PIC X     VALUE "-".
            02 COLUMN 87    PIC 9999  SOURCE INV-YR.
            02 COLUMN 92    PIC 9(6)  SOURCE INVOICE-NUMBER.
            02 COLUMN 99    PIC $$$,$$$,$$$.99-
                                      SOURCE INVOICE-SALES.
            02 DETAIL-COUNT PIC S9(10) SOURCE ONE-COUNT.
            02 INV-AMOUNT   PIC S9(9)V99 SOURCE INVOICE-SALES.
    01      TYPE IS CONTROL FOOTING NAME
                    NEXT GROUP IS PLUS 2.
            02      LINE IS PLUS 2.
                    03      COLUMN  73
                            PIC X(39) VALUE ALL "*".
            02      LINE IS PLUS 1.
                    03      COLUMN  20  PIC X(17) VALUE " TOTAL RECORDS: ".
                    03 IDC  COLUMN  40  PIC ZZZ,ZZZ,ZZ9 SUM ONE-COUNT.
                    03      COLUMN  73  PIC X(22) VALUE "*  INVOICE SUB TOTAL: ".
                    03 IIA  COLUMN  96  PIC $$$,$$$,$$$.99- SUM INVOICE-SALES.
                    03      COLUMN  111 PIC X VALUE "*".
            02      LINE IS PLUS 1.
                    03      COLUMN  73
                            PIC X(39) VALUE ALL "*".
    01      FINAL-FOOTING TYPE IS CONTROL FOOTING FINAL
                          NEXT GROUP NEXT PAGE.
            02      LINE IS PLUS 2.
                    03      COLUMN  70
                            PIC X(42) VALUE ALL "*".
            02      LINE IS PLUS 1.
                    03      COLUMN  14 PIC X(21) VALUE "GRAND TOTAL RECORDS: ".
                    03 FDC  COLUMN  40 PIC ZZZ,ZZZ,ZZ9 SUM IDC.
                    03      COLUMN  70 PIC X(24) VALUE "*  GRAND TOTAL INVOICES:".
                    03 FIA  COLUMN  94 PIC $,$$$,$$$,$$$.99- SUM IIA.
                    03      COLUMN  111 PIC X VALUE "*".
            02      LINE IS PLUS 1.
                    03      COLUMN  70
                            PIC X(42) VALUE ALL "*".
    01      REPORT-FOOTER TYPE IS REPORT FOOTING.
            02      LINE 24  ON NEXT PAGE COLUMN  45
                            PIC X(31) VALUE ALL "*".
            02      LINE 25.
                    03      COLUMN  45
                            PIC X VALUE "*".
                    03      COLUMN 75
                            PIC X VALUE "*".
            02      LINE 26.
                    03      COLUMN  45
                            PIC X(31) VALUE "*    Customer Master File     *".
            02      LINE 27.
                    03      COLUMN  45
                            PIC X VALUE "*".
                    03      COLUMN 75
                            PIC X VALUE "*".
            02      LINE 28.
                    03      COLUMN  45
                            PIC X VALUE "*".
                    03      COLUMN  55
                            PIC Z9
                            SOURCE UE-DAY.
                    03      COLUMN  57
                            PIC X   VALUE "-".
                    03      COLUMN  58
                            PIC 99
                            SOURCE UE-MONTH.
                    03      COLUMN  60
                            PIC X   VALUE "-".
                    03      COLUMN  61
                            PIC 9999
                            SOURCE UE-YEAR.
                    03      COLUMN  75
                            PIC X VALUE "*".
            02      LINE 29.
                    03      COLUMN  45
                            PIC X VALUE "*".
                    03      COLUMN 75
                            PIC X VALUE "*".
            02      LINE 30 COLUMN  45
                            PIC X(31) VALUE "*     End of Report EX1010    *".
            02      LINE 31.
                    03      COLUMN  45
                            PIC X VALUE "*".
                    03      COLUMN 75
                            PIC X VALUE "*".
            02      LINE 32 COLUMN  45
                            PIC X(31) VALUE ALL "*".

    01      PAGE-FOOTING TYPE IS PAGE FOOTING.
            02      LINE 59.
                    03      COLUMN 45
                            PIC X(16) VALUE "C O M P A N Y  ".
                    03      COLUMN  62
                            PIC X(25) VALUE  "C O N F I D E N T I A L  ".
            02      LINE 60.
                    03      COLUMN 45
                            PIC X(16) VALUE "C O M P A N Y  ".
                    03      COLUMN  62
                            PIC X(25) VALUE  "C O N F I D E N T I A L  ".
    PROCEDURE DIVISION.
    DECLARATIVES.
    BOR SECTION.
            USE BEFORE REPORTING REPORT-HEADER.
    EOR SECTION.
            USE BEFORE REPORTING REPORT-FOOTER.
    EOR-A.
            DISPLAY "*** Created EX1010.LIS ***".
    END DECLARATIVES.

    MAIN SECTION.
    000-DO-SORT.

           SORT SORT-FILE ON ASCENDING KEY SORT-NAME
                WITH DUPLICATES IN ORDER
                USING CUSTOMER-FILE
                GIVING SORTED-FILE.
    000-START.
            DISPLAY "*** EX1010 ***".
            DISPLAY "Enter Current Date (YYYYMMDD) :".
            ACCEPT UNEDITED-DATE.
            OPEN INPUT  SORTED-FILE.
            OPEN OUTPUT PRINTER-FILE.
            INITIATE MASTER-LIST.
            PERFORM 200-READ-MASTER UNTIL NAME = HIGH-VALUES.
    100-END-OF-FILE.
            TERMINATE MASTER-LIST.
            CLOSE SORTED-FILE, PRINTER-FILE.
            STOP RUN.
    200-READ-MASTER.
            READ SORTED-FILE AT END MOVE HIGH-VALUES TO NAME.
            IF NAME NOT = HIGH-VALUES GENERATE MASTER-LIST.

Figure 10-19 EX1010.LIS Listing

Previous | Next | Contents | Index