Download presentation
Presentation is loading. Please wait.
Published byGiovanna Valgueiro Bastos Modified over 6 years ago
1
Designing and Writing Control-Break Programs
Chapter 10 Designing and Writing Control-Break Programs
2
Types of Reports Detail or Transaction Reports Exception Reports
Include one or more lines of output for each input record read Exception Reports Printout of individual records that meet (or fail to meet) certain criteria Summary Reports Summarizes rather than itemizes to provide more comprehensive information
3
Topics Single-Level Control-Break Programs
Sequence of input records is important Data is sorted on the control-break field Multiple-level Control-Break Programs Input data is sorted on two or more fields Control-Break is Similar to Page Breaks
4
Control-Break Processing
The input data must be sorted (Note: Chapter 13 covers detail of how your program can sort a file) For now, we will assume the input file is already sorted (i.e., Sales Rep Number) It could be sorted on two or three fields
6
Processing Logic Loop until EOF Print Ctrl-break Totals Read record
If First-Record Set the Saved-Ctrl-Nbr If Ctrl-Nbr not equal Saved-Ctrl-Nbr Print Ctrl-break totals Reset Ctrl-break totals Set the Saved-Ctrl-Nbr Process record Print Ctrl-break Totals
9
Processing Logic When the “Next Record” does not match the Saved Control Number Print the control-break total Reset accumulators Don’t forget about page break processing Two types of Print Lines: Detail Line Control-break Total Line At EOF, print last Control-break Total
10
Complex Programs Suppose there are two, or even three, control fields
The input file must be sorted on all fields (sorted in the proper sequence) Sub-totals for each control-break
11
Complex Programs Input Data:
State, Branch, Sales Rep Number, other data AR AR AR AR AR AR KY KY KY KY KY KY KY
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.