Minor Breaks Presentation
This presentation deals with the logic of MINOR TOTAL BREAKS. To see actual programs, see the sample programs at the site.
Also, be sure to read the document on breaks.
The input file is in order by dept #. When the dept # changes, we want to print out a total for that dept.
When all records have been processed, we want to print out a final total line containing the total of all records processed. This is the same as saying the sum of all of the departments.
This slide shows the processing for record one.
The READ for record 1 is done separately - the initializing read - this means that the information from this record can be used to initialize the HOLD area. In this case, we are moving the DEPT from the input record to the hold area called DEPT-HOLD. We are then adding the AMOUNT on the record to DEPT-TOTAL and FINAL-TOTAL.
Note that on the flowchart, I referred to DEPT-TOTAL in a more generic way as MINOR-TOTAL.
When the second record is processed, there is no break because the DEPT is equal to the DEPT-HOLD. Therefore the amounts are added to the accumulators and the line is written.
The third record is also from the same department so there is no break. The amount is added to the accumulators and the detail line is written.
The fourth record causes a break because DEPT on the fourth record is not = DEPT-HOLD.
The MINOR-ROUT is processed which means:
1. The DEPT-TOTAL which is the minor total is moved to the
minor total line.
2. The minor total line is written
3. The DEPT-HOLD area is reset which means DEPT is moved
to the DEPT-HOLD.
4. The DEPT-TOTAL which is the minor total is reset to 0.
The record that caused the break is now processed.
1. The detail line is written with the information from the
2. The amount is added to the DEPT-TOTAL which is the minor total and the FINAL-TOTAL.
The logic of minor break processing is noted on this slide.
This is page 1 of the logic flowchart. I am assuming a break on a field called DEPT for illustration purposes.
This is page 2 of the logic flowchart. Again, for illustration purposes, I am assuming that the MINOR break is caused by a change in DEPT.