Report Writer Structures - Sample Program

Restriction: This topic applies only when the AppMaster Builder AddPack has been installed, and applies only to Windows platforms.

This program includes a report mock-up, complete program, generated source code, and the final printed report derived from the program.

Report Mock-up

                 WONDERFUL WIDGETS INCORPORATED

                          STOCK REPORT

                           XXXXXX XXX

                          MID-ATLANTIC
                          STOCK REPORT
                           XXXXXX XXX

LOCATION          LAST COUNT     QUANTITY IN    QUANTITY    QUANTITY
                    DATE          STOCK         ISSUED     RECEIVED

XXXXXXXXXXXX    99/99/99         ZZZ,ZZ9      ZZZ,ZZ9     ZZZ,ZZ9

                               ---------     ---------  ---------
TOTAL BY LOCATION:             Z,ZZZ,ZZ9     Z,ZZZ,ZZ9  Z,ZZZ,ZZ9

TOTAL NUMBER OF SALES BY LOCATION:       ZZZ,ZZ9

TOTAL WONDERFUL WIDGETS IN STOCK:      Z,ZZZ,ZZ9

TOTAL WONDERFUL WIDGETS ISSUED:        Z,ZZZ,ZZ9

TOTAL WONDERFUL WIDGETS RECEIVED:      Z,ZZZ,ZZ9

TOTAL WONDERFUL WIDGETS SOLD:          Z,ZZZ,ZZ9

                                                         PAGE ZZZ9
                             *****  END OF REPORT  *****

Program Painter Source

 IO  INPUT-FILE ASSIGN [TO] DYNAMIC FILEIN
 IO  REPORT-OUTPUT-FILE ASSIGN "REPTOUT".       
 FD  INPUT-FILE
     LABEL RECORDS ARE STANDARD
     BLOCK CONTAINS 0 CHARACTERS.
 01  PART-STOCK-REC              PIC X(80).
FD  REPORT-OUTPUT-FILE
     LABEL RECORDS ARE STANDARD
     REPORT IS STOCK-REPORT.
WS  WS-PART-STOCK-REC.
     05  WS-LOCATION-CODE         
         ... PIC X(12)  VALUE SPACES.
     05  WS-LAST-COUNT-DATE.
         10  WS-LAST-COUNT-MONTH PIC 99    VALUE 0.
         10  WS-LAST-COUNT-DAY   PIC 99    VALUE 0.
         10  WS-LAST-COUNT-YEAR  PIC 99    VALUE 0.
     05  WS-QTY-IN-STOCK         PIC 9(6)  VALUE 0.
     05  WS-QTY-ISSUED           PIC 9(6)  VALUE 0.
     05  WS-QTY-RECEIVED         PIC 9(6)  VALUE 0.
     05  WS-NO-OF-SALES          PIC 9(4)  VALUE 0.
     05  FILLER                  
         ...PIC X(40) VALUE SPACES.
 WS  WS-DATE.
     05  WS-DATE-MM              PIC 9(2).
     05  WS-DATE-DD              PIC 9(2).
     05  WS-DATE-YY              PIC 9(2).
 WS  WS-DATE-HOLD.
     05  WS-DATE-YY-X            PIC 9(2).
     05  WS-DATE-MM-X            PIC 9(2).
     05  WS-DATE-DD-X            PIC 9(2).


 RED STOCK-REPORT
     CONTROLS ARE FINAL WS-LOCATION-CODE
     PAGE LIMIT IS 50
     FIRST DETAIL 10
     LAST DETAIL 40
     FOOTING 47.
 MOCK STCKRPT
 01  TYPE IS REPORT HEADING NEXT GROUP 
         NEXT PAGE
     MOCKUP LINES 1 THRU 6
     SOURCE WS-DATE

 01  TYPE IS PAGE HEADING.
     MOCKUP LINES 7 THRU 9
     SOURCE WS-DATE

 01  TYPE IS CONTROL HEADING WS-LOCATION-CODE.
     MOCKUP LINES 10 THRU 13

 01  DETAIL-LINE TYPE IS DETAIL.
     MOCKUP LINE 14
     SOURCE WS-LOCATION-CODE      GROUP INDICATE
     SOURCE WS-LAST-COUNT-MONTH  PIC 99
     SOURCE WS-LAST-COUNT-DAY    PIC 99
     SOURCE WS-LAST-COUNT-YEAR   PIC 99
     SOURCE WS-QTY-IN-STOCK
     SOURCE WS-QTY-ISSUED
     SOURCE WS-QTY-RECEIVED
     REFERENCE WS-NO-OF-SALES    PIC ZZZ9

 01  TYPE IS CONTROL FOOTING WS-LOCATION-CODE.
     MOCKUP LINES 15 THRU 21
     SUM WS-QTY-IN-STOCK
     SUM WS-QTY-ISSUED
     SUM WS-QTY-RECEIVED
     SUM WS-NO-OF-SALES

 01  TYPE IS CONTROL FOOTING FINAL.
     MOCKUP LINES 22 THRU 30
     SUM WS-QTY-IN-STOCK
     SUM WS-QTY-ISSUED
     SUM WS-QTY-RECEIVED
     SUM WS-NO-OF-SALES

 01  TYPE IS PAGE FOOTING.
     MOCKUP LINE 31
     SOURCE PAGE-COUNTER

 01  TYPE IS REPORT FOOTING LINE PLUS 2.
     MOCKUP LINES 32 THRU 33

 NTRY
     OPEN INPUT INPUT-FILE
     ...OUTPUT REPORT-OUTPUT-FILE
     ACCEPT WS-DATE-HOLD FROM DATE
     MOVE WS-DATE-YY-X TO WS-DATE-YY
     MOVE WS-DATE-MM-X TO WS-DATE-MM
     MOVE WS-DATE-DD-X TO WS-DATE-DD
     INITIATE STOCK-REPORT
     REPEAT
         READ INPUT-FILE INTO WS-PART-STOCK-REC
     UNTIL AT END ON INPUT-FILE
         GENERATE DETAIL-LINE
     TERMINATE STOCK-REPORT
     CLOSE INPUT-FILE
     ... REPORT-OUTPUT-FILE

Generated Source

 %   &AP-GEN-VER = 3000
 %   &AP-PGM-D = "STOCK1"
 %   &AP-GEN-DC-TARGET = "PC"
 %   &AP-TP-ENTRY-KYWD-SEEN = 1
 %   &AP-FILE-CONTROL-SEEN = 1
 IDENTIFICATION DIVISION.
 PROGRAM-ID.                      STOCK1.
 AUTHOR.                          AP-SYSTEM GENERATED.
 DATE-WRITTEN.                    140125.
 DATE-COMPILED.                   &COMPILETIME.
 ENVIRONMENT DIVISION.
 CONFIGURATION SECTION.
 SOURCE-COMPUTER.                 &SYSTEM.
 OBJECT-COMPUTER.                 &SYSTEM.
 INPUT-OUTPUT SECTION.
 FILE-CONTROL.
     INPUT-FILE ASSIGN [TO] DYNAMIC FILEIN.
     REPORT-OUTPUT-FILE ASSIGN "REPTOUT".       
 DATA DIVISION.
 FILE SECTION.
 FD  INPUT-FILE
     LABEL RECORDS ARE STANDARD
     BLOCK CONTAINS O CHARACTERS.
 01  PART-STOCK-REC             PIC X(80).
 FD  REPORT-OUTPUT-FILE
     LABEL RECORDS ARE STANDARD
     REPORT IS STOCK-REPORT.

 WORKING-STORAGE SECTION.
 01  WS-PART-STOCK-REC.
     05  WS-LOCATION-CODE        PIC X(12) VALUE SPACES.
     05  WS-LAST-COUNT-DATE.
         10  WS-LAST-COUNT-MONTH PIC 99    VALUE O.
         10  WS-LAST-COUNT-DAY   PIC 99    VALUE O.
         10  WS-LAST-COUNT-YEAR  PIC 99    VALUE O.
     05  WS-QTY-IN-STOCK         PIC 9(6)  VALUE O.
     05  WS-QTY-ISSUED           PIC 9(6)  VALUE O.
     05  WS-QTY-RECEIVED         PIC 9(6)  VALUE O.
     05  WS-NO-OF-SALES          PIC 9(4)  VALUE O.
     05  FILLER                  PIC X(40) VALUE SPACES.
 01  WS-DATE.
     05  WS-DATE-MM              PIC 9(2).
     05  WS-DATE-DD              PIC 9(2).
     05  WS-DATE-YY              PIC 9(2).
 01  WS-DATE-HOLD.
     05  WS-DATE-YY-X            PIC 9(2).
     05  WS-DATE-MM-X            PIC 9(2).
     05  WS-DATE-DD-X            PIC 9(2).

 REPORT SECTION.
 RED STOCK-REPORT
     CONTROLS ARE FINAL, WS-LOCATION-CODE
     PAGE LIMIT IS 50
     FIRST DETAIL 10
     LAST DETAIL 40
     FOOTING 47.

01  TYPE IS REPORT HEADING NEXT GROUP NEXT PAGE.
MOCKUP LINES 1 THRU 6
SOURCE WS-DATE

01  TYPE IS PAGE HEADING.
MOCKUP LINES 7 THRU 9
SOURCE WS-DATE

01  TYPE IS CONTROL HEADING WS-LOCATION-CODE.
MOCKUP LINES 10 THRU 13

01  DETAIL-LINE TYPE IS DETAIL.
MOCKUP LINE 14
SOURCE WS-LOCATION-CODE       GROUP INDICATE
SOURCE WS-LAST-COUNT-MONTH    PIC 99
SOURCE WS-LAST-COUNT-DAY      PIC 99
SOURCE WS-LAST-COUNT-YEAR     PIC 99
SOURCE WS-QTY-IN-STOCK
SOURCE WS-QTY-ISSUED
SOURCE WS-QTY-RECEIVED
REFERENCE WS-NO-OF-SALES      PIC zzz9

01  TYPE IS CONTROL FOOTING WS-LOCATION-CODE.
MOCKUP LINES 15 THRU 21
SUM WS-QTY-IN-STOCK
SUM WS-QTY-ISSUED
SUM WS-QTY-RECEIVED
SUM WS-NO-OF-SALES

01  TYPE IS CONTROL FOOTING FINAL.
MOCKUP LINES 22 THRU 30
SUM WS-QTY-IN-STOCK
SUM WS-QTY-ISSUED
SUM WS-QTY-RECEIVED
SUM WS-NO-OF-SALES

01  TYPE IS PAGE FOOTING.
MOCKUP LINE 31
SOURCE PAGE-COUNTER

01  TYPE IS REPORT FOOTING.
MOCKUP LINES 32 THRU 33

$TP-ENTRY
    OPEN INPUT INPUT-FILE
    ...OUTPUT REPORT-OUTPUT-FILE
    ACCEPT WS-DATE-HOLD FROM DATE
    MOVE WS-DATE-YY-X TO WS-DATE-YY
    MOVE WS-DATE-MM-X TO WS-DATE-MM
    MOVE WS-DATE-DD-X TO WS-DATE-DD
    INITIATE STOCK-REPORT
    REPEAT
        READ INPUT-FILE INTO WS-PART-STOCK-REC
    UNTIL AT END ON INPUT-FILE
        GENERATE DETAIL-LINE
    TERMINATE STOCK-REPORT
    CLOSE INPUT-FILE
    ... REPORT-OUTPUT-FILE

Printed Report

                 WONDERFUL WIDGETS INCORPORATED
                          STOCK REPORT
                           01/25/14
                          MID-ATLANTIC
                          STOCK REPORT
                           01/25/14

LOCATION       LAST COUNT     QUANTITY IN    QUANTITY    QUANTITY
                  DATE          STOCK         ISSUED     RECEIVED

ALEXANDRIA      05/01/90             111          222         333
                06/01/90             111          222         333
                07/01/90             111          222         333
                08/01/90             111          222         333
                09/01/90             111          222         333
                10/01/90             111          222         333
                11/01/90             111          222         333
                               _________    _________   _________
TOTAL BY LOCATION:                   777        1,554       2,331

TOTAL NUMBER OF SALES BY LOCATION:     3,108

               LAST COUNT     QUANTITY IN    QUANTITY    QUANTITY
LOCATION          DATE          STOCK         ISSUED     RECEIVED

BALTIMORE       06/01/90              11           22          33
                08/01/90              11           22          33
                09/01/90              11           22          33
                10/01/90              11           22          33
                11/01/90              11           22          33
                               _________    _________   _________
TOTAL BY LOCATION:                    55          110         165

TOTAL NUMBER OF SALES BY LOCATION:       220

                                                            PAGE    1

                          MID-ATLANTIC
                          STOCK REPORT
                           01/25/14

               LAST COUNT     QUANTITY IN    QUANTITY    QUANTITY
LOCATION          DATE          STOCK         ISSUED     RECEIVED

ROCKVILLE       05/01/90              11           22          33
                06/01/90              11           22          33
                07/01/90              11           22          33
                08/01/90              11           22          33
                09/01/90              11           22          33
                10/01/90              11           22          33
                11/01/90              11           22          33
                               _________    _________   _________
TOTAL BY LOCATION:                    77          154         231

TOTAL NUMBER OF SALES BY LOCATION:       308

               LAST COUNT     QUANTITY IN    QUANTITY    QUANTITY
LOCATION          DATE          STOCK         ISSUED     RECEIVED

WASHINGTON      06/01/90         111,111      222,222     333,333
                07/01/90         111,111      222,222     333,333
                08/01/90         111,111      222,222     333,333
                09/01/90         111,111      222,222     333,333
                10/01/90         111,111      222,222     333,333
                11/01/90         111,111      222,222     333,333
                               _________    _________   _________
TOTAL BY LOCATION:               666,666    1,333,332   1,999,998

TOTAL NUMBER OF SALES BY LOCATION:    26,664

                                                            PAGE    2


                          MID-ATLANTIC
                          STOCK REPORT
                           01/25/14

TOTAL WONDERFUL WIDGETS IN STOCK:        667,575
TOTAL WONDERFUL WIDGETS ISSUED:        1,335,150
TOTAL WONDERFUL WIDGETS RECEIVED:      2,002,725
TOTAL WONDERFUL WIDGETS SOLD:             30,300

                                                            PAGE    3
                             *****  END OF REPORT  *****