The report specification sections contain the statements that describe report title pages, headings, subheadings, footings, and perform subtotaling.
The TITLES section is used to print title pages of reports. This section is executed only once after the INITIAL section of the Process Module (PM). Report title pages are produced without affecting the page counter. (@PAGE gets reset to 1 after the TITLES section is completed). Top or bottom margins are not produced. The FOOTINGS section is not executed for title pages. After executing this section, an automatic "skip to top" is performed so as to fill out the page. The reporting proceeds normally after that. Page dividers, if specified, are printed before this section is executed. The first record from the master Data Set (DS) is available for read-only in this section. No transaction record is available, but auxiliary DS records are available if a GET has been executed.
If only one report is being created, the output statements for the title page will follow the TITLES section statement. If multiple reports are being created, the TITLES section will contain a number of subsections. Each subsection is introduced by the statement REPORT n. The subsection numbers n must be in ascending order. They do not have to be consecutive numbers because titles are not needed for every report.
TITLES SECTION
report 1
Print on 1 “REPORT FOR NORTHERN TERRITORY”
REPORT 2
Print ON 2 “REPORT FOR EASTERN TERRITORY”
REPORT 3
Print ON 3 “REPORT FOR SOUTHERN TERRITORY”
The HEADINGS section contains statements that print heading information at the top of each report page. The section is automatically executed at the top of every report page (except title pages) unless this section has been disabled with a TURN HEADINGS OFF statement. The FOOTINGS section, bottom margin, a page divider, and the top margin for the new page will be executed just prior to the HEADINGS section if they have been specified. The last record of the last subtotal group is available by default in this section. The statement REFERENCE NEXT can be used to access the first record of the next subtotal group.
If only one report is being created, the section consists of heading definition statements. If multiple reports are being created, each report's heading statements must be preceded by a REPORT n statement. The sub-section report numbers must be in ascending order, but need not be consecutive.
HEADINGS SECTION
REPORT 1
Print on 1 “PARTNUMBER PRICE QUANTITY”
REPORT 2
Print on 2 “PARTNUMBER PRICE QUANTITY”
The SUBHEADINGS section consists of blocks of statements, each beginning with an ON \\fields\\ statement. Whenever a value change occurs in a field that is included in the ON \\fields\\ statement, the related block of statement is executed. This occurs before the record processing sections execute. For the first record, execution begins at the first ON \\fields\\ statement. All fields in the ON list must be in the Master Data Set.
If multiple reports are being created, each report output statement in this section must include an ON n clause where n is the report number.
SUBHEADING SECTION
ON STATE
Print “REPORT FOR”, state
ON CITY
Print “REPORT FOR”, city, “in”, state
ON STORE
Print “REPORT FOR STORE”, store, “in”, state
The FOOTINGS section is used in PM's that generate reports to specify information to be printed at the bottom of report pages (above the bottom margin). This section executes once at the bottom of each page. If a FOOTINGS section is specified, @FOOTING_SIZE must be set to a non-zero value in the INITIAL section.
If the footing size is larger than the number of lines printed by the FOOTINGS section print statements, the remaining lines are filled with blanks. If the footing size is smaller than the number of lines needed to execute the print statements, the statements will not execute and the footing will consist of blank lines.
If multiple reports have been related, the statements for each report footing must be preceded by a REPORT n statement. The subsection report numbers must be in ascending order, but need not be consecutive.
FOOTINGS SECTION
REPORT 1
PRINT 'Total for this page is: ' PAGE_TOTAL
0 TO PAGE_TOTAL
REPORT 2
PRINT 'Total this page is: ',PAGET
0 TO PAGET
The TOTALS section is used to control calculation and printing of subtotals in PM that generate reports. However, its use is not restricted to reports. It can be used to accumulated and print session totals when the program completes. This section consists of statement blocks. Each block is introduced by ON \\fields\\ statements. For each record, this section begins executing on the first ON \\fields\\ statement where the values of the key fields in the current record are different from the values in the preceding record. The order of ON \\fields\\ statements is from lowest level break field to highest level break field (from minor to major breaks). Only master fields can be used in ON statements. The five inter-record functions, SUM, MIN, MAX, AVG, and STD_DEV, can be used in the TOTALS section. The last record from the last subtotal group is available by default in this section. To view the first record of the next group, use the statement REFERENCE NEXT.
If multiple reports have been related, then each report output statement in this section must include an ON n clause. Totals may not be needed for each report being created.
TOTAL SECTION
ON STORE
PRINT ON 1 “TOTAL FOR”, STORE, “IS”, SUM PRICE
PRINT ON 2 “TOTAL FOR”, STORE, “IS”, SUM PRICE
ON CITY
PRINT ON 1 “TOTAL FOR”, CITY, “IS”, SUM PRICE
PRINT ON 2 “TOTAL FOR”, CITY, “IS”, SUM PRICE