Minor, Intermediate and Major Breaks

Speaker Notes

Slide 1:

These slides will go over the logic for minor, intermediate and major breaks in a program.

Slide 2:

This is the input data for the program called major.cbl that is available at the site. It is the one that was also discussed in class.

Slide 3:

This is the output report from the program major.cbl.

Slide 4:

This shows the first seven records and the resulting report.

Notice then when the dept breaks, I print a dept total before processing the record that caused the break and when the br changes, I print a branch total before processing the record that caused the break.

Slide 5:

This is the logic flowchart - page 1.

Note that with the first or initializing read I can do special processing because this read only applies to the first record. The special processing that I do is to move the data from the first record to the hold areas.

Note also that when I am done with the processing of the B-200-LOOP which happens when I have hit EOF, I perform the MINOR-ROUT for the last department so it will have a total, INTER-ROUT for the last branch so it will have a total, MAJOR-ROUT for the last division so it will have a total and then finally the FINAL-ROUT to get a total for the entire data file.

Slide 6:

This is the logic flowchart - page 2.

Note that I check for the highest level of break first because I am making the assumption that if the division chances, the branch and department also change. If this is not a valid assumption, I would need to code different logic.

If the division breaks, I want to process the total for the last department within the division (MINOR-ROUT), the last branch within the division (INTER-ROUT) and the division itself (MAJOR-ROUT).

If the branch breaks, I want to process the total for the last department within the division (MINOR-ROUT) and then the branch itself (INTER-ROUT).

If the department breaks, I want to process the total for the department only (MINOR-ROUT).

If no break happens I do nothing in this IF. I simply fall through to the B which branches to the next page.

Slide 7:

This is the logic flowchart - page 3.

If no break happened, I fall through and process the detail record and read another record.

If a break happened, once I have printed the totals, I fall through to process the detail record that caused the break and then read another record.

In the detail routine, I write headers if needed, set up the detail line including any calculations that need to be done, write the detail line and then add to the accumulators. If there are multiple totals at each level, I will add to all of the accumulators here.

Slide 8:

This is the logic flowchart - page 4.

The total routines are all very similar. I set up the total line, write the total line and then reset the hold area that goes with that line and reset the totals that go with that line.

In other words, for a minor break I am resetting dept hold and the dept or minor totals, for the inter break I am resetting the br hold and the inter or branch totals and for the major break I am resetting the div hold and the div or major totals.

Slide 9:

This is the logic flowchart - page 5.

It simply handles writing headers and the wrapup which closes the files.

Slide 10:

This shows the logic flowchart and code for B-100-PROCESS.

Remember the logic flowchart is generic except for the references to DIV, BR and DEPT while the code is for a specific problem.

Slide 11:

This slide shows the beginning of the B-200-LOOP which checks for breaks and performs the appropriate total routines. The B-200-LOOP is continued on the next slide.

Slide 12:

This is the end of the B-200-LOOP.

Slide 13:

This slide shows the detail routine.

Slide 14:

This slide shows the minor routine.

Slide 15:

This is the intermediate routine.

Slide 16:

This is the major routine.

Slide 17:

This is the final routine.

Slide 18:

This is the header routine and the wrapup routine.