After you create a mock-up, you define the report logic in the Program Painter using AMB Report Writer structures. Report Writer structures let you automatically perform paging, calculate field values, test and execute control breaks, generate multiple reports, and generate all logic necessary to map fields between reports and databases or files. You can include multiple reports in a single program. Follow this process:
First, using the Program Painter IO and FD keywords, name the input data file, the output report file, and the report itself.
Then, with the Program Painter RED, MOCK, and 01 keywords, you add a Report Section naming the report and defining the format of each report named. There are two types of format entries.
AMB categorizes the report lines into report groups, which are groups of report lines that make up the headings, body, and footings of the report. Report groups are:
The following table shows a sample mock-up with the various report group types.
Report Heading |
WONDERFUL WIDGETS INCORPORATED STOCK REPORT XXXXXX XXX |
Page Heading |
MID-ATLANTIC STOCK REPORT XXXXXX XXX |
Control Heading |
LOCATION LAST COUNT QUANTITY QUANTITY QUANTITY DATE IN STOCK ISSUED RECEIVED |
Detail Line |
XXXXXXXXXXXX 99/99/99 ZZZ,ZZ9 ZZ,ZZ9 ZZZ,ZZ9 --------- --------- --------- |
Control Footing |
TOTAL BY LOCATION: Z,ZZZ,ZZ9 Z,ZZZ,ZZ9 Z,ZZZ,ZZ9 |
Control Footing Final |
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 Footing |
PAGE ZZZ9 |
Report Footing |
***** END OF REPORT ***** |
Entries for the detail lines that make up the body of the report describe the characteristics of the data items, such as the format, its placement in relation to the other data items, and any control factors. You use the following statements to define the line contents.
You use controls to specify how to arrange the data your report displays. For example: you might want to display detail lines arranged by sales territories within cities or states or both. You can have up to 28 control breaks. AMB processes controls from the most inclusive down to the least inclusive, that is from major to minor. When a data item designated as a control changes value, such as a monthly change in a date field, a control break occurs, and AMB:
In the Procedure Division, you open your input and output files, execute and print the report, and close the files, using the following Report Writer statements:
The next two figures illustrate GENERATE processing.
AMB provides two counters that you can use in any Procedure Division statement.