[an error occurred while processing this directive]
HP OpenVMS Systems Documentation |
HP COBOL
|
Previous | Contents | Index |
In summary reporting, the GENERATE statement performs all of the automatic operations of the Report Writer facility, but does not produce any TYPE DETAIL report groups.
A report name references the name of an RD entry. If MASTER-LIST is an
RD entry, then GENERATE MASTER-LIST produces HEADING and FOOTING report
groups (in the order defined), but omits DETAIL report group lines.
10.9 Report Writer Examples
This section provides you with the input data and sample reports produced by five Report Writer programs. Each sample report has a program summary section that describes the Report Writer features used in that program; you can examine the summary and output to determine the usage of Report Writer features. Note that each sample report is followed by the program that was used to generate it.
Also, many of the report pages in Reports 2 through 5 have been compressed into fewer pages than you would normally find. For example, a report title page is typically found on a separate page. Whether you are producing a report for yourself or for a customer, you must begin by designing the report.
On OpenVMS, the Report Writer facility produces a report file in print-file format. When Report Writer positions the file at the top of the next logical page, it positions the pointer by line spacing, rather than page ejection or form feed. The default OpenVMS PRINT command inserts a form-feed character when a form is within four lines of the bottom. Therefore, when the default PRINT command refers to a Report Writer file, unexpected page spacing can result. The /NOFEED file qualifier of the PRINT command suppresses the insertion of form-feed characters and prints Report Writer files correctly. Consequently, you should use the /NOFEED qualifier when you use the Report Writer facility to print a report on OpenVMS. <> |
The data records shown in Figure 10-14 are used for the programs in this section.
Figure 10-14 Sample MASTER.DAT File
EX1006 uses the PAGE HEADING, DETAIL, and CONTROL FOOTING report groups and produces a detail report---EX1006.LIS.
To get EX1006.LIS, you use the following commands:
On OpenVMS
$ COBOL EX1006 $ LINK EX1006 $ RUN EX1006 $ PRINT/NOFEED EX1006.LIS <> |
Note that the case of the command parameters is insignificant in the preceding command example.
On Tru64 UNIX
% cobol ex1006.cob % a.out % lpr EX1006.LIS <> |
Note that the case of the file name, EX1006.LIS, is significant in the preceding command example, because the file specification in the ASSIGN statement in Example 10-6 was given in upper case. The program (EX1006) in Example 10-6 produces the output shown in Figure 10-15 (EX1006.LIS).
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). 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 CONTROL IS FINAL. 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 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. 02 COLUMN 17 PIC X(10) SOURCE FIRST-NAME. 02 COLUMN 28 PIC XX SOURCE MIDDLE-INIT. 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 FINAL-FOOTING TYPE IS CONTROL FOOTING FINAL LINE PLUS 5 NEXT GROUP NEXT PAGE. 02 COLUMN 20 PIC X(17) VALUE "TOTAL RECORDS: ". 02 FDC COLUMN 40 PIC ZZZ,ZZZ,ZZ9 SUM ONE-COUNT. 02 COLUMN 75 PIC X(15) VALUE "TOTAL SALES: ". 02 FIA COLUMN 95 PIC $$$,$$$,$$$,$$$.99- SUM INVOICE-SALES. PROCEDURE DIVISION. 000-DO-SORT. DISPLAY "*** EX1006 ***". SORT SORT-FILE ON ASCENDING KEY SORT-NAME WITH DUPLICATES IN ORDER USING CUSTOMER-FILE GIVING SORTED-FILE. DISPLAY "*** Created EX1006.LIS ***". 050-START. OPEN INPUT SORTED-FILE. OPEN OUTPUT PRINTER-FILE. ACCEPT UNEDITED-DATE FROM DATE. 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-15 EX1006.LIS Listing
Previous | Next | Contents | Index |