To incorporate accumulation in your program you must address the following needs.
In the DATA DIVISION:
Define the accumulator data-item
In the PROCEDURE DIVISION:
Initialize the accumulator to Zero.
As each record to processed, add the contribution to the accumulator.
After the last record is processed, print the total line, including the accumulator’s contents.
Page Control:
When a page becomes full the printer is directed to position the form at the top of the next page before printing continues. This is called page control and its implemented by counting each line as it is printed and comparing that count to some predetermined allowable number of lines per page.
To incorporate page control into your program you must address the following needs.
In the DATA DIVISION
Define a line-counter data-item
Define a page-number data item
Define the number of lines to be printed on a page.
In the PROCEDURE DIVISION
Initialize the page-number to zero.
Before printing a detail line, check the line-counter to see If the page is full.
If the page is full, start a new page initialize the line-counter and ADD 1 to page-number.
As each detail line is printed ADD to the line-counter.
Printing Heading:
Implicit with page control is the repeated printing of heading; that is headings are printed at the top of each page. Actually heading must be printed under two conditions.
- Before processing the first record
- When the current page is full and the form mores to the next page, commonly called a page break.
Page Total:
The report total can be considered in two ways, as the sum of all individual record contributes or as the sum of the page totals. Using the latter techniques, the processing the sequence is
1. With each detail record, add the contribution to the page accumulator.
2. At a page break. (When a full page occurs).
a. Print the page-total line.
b. Progress to a new page and print the heading
c. Add the page-accumulator value to the report to the accumulator.
d. Set the page accumulator to zero.
Designing a Report Program:
Divide the page into four each sections.
- The Top Margin: Lines at the top of the page on which nothing is printed.
- The Body: Where detail lines are printed
- The Footing: Is somewhat of a printing overflow area. Its only use is to print summary lines (page total in this case) that must be kept on the same page as the output preceding it, but might otherwise be printed on the next page.
- The Bottom Margin: Similar to the top margin, nothing is printed here.
For this application, assumes that the form requirements are as follows.
· A standard 11-inch form length
· Top margin of 4 lines
· Bottom margin of 3 lines
· Footing of 5 lines
- After determining the user’s needs and that required input is available for generating the desired output, we now proceed to the program specification.
Steps:
- List functional program modules
- Describe over are program function
- Show major program functions
- Initialize-variable-fields
- Print-headings
- Process record
- Print-page-total-line
- Print-report-total-line
No comments:
Post a Comment