SlideShare a Scribd company logo
7




      Control Breaks


Programming Logic and Design,
Second Edition, Comprehensive




       Chapter 7         1
7
                  Objectives

• After studying Chapter 7, you should be able to:
• Understand control break logic
• Perform single-level control breaks
• Use control data within the control break module
• Perform control breaks with totals
• Perform multiple-level control breaks
• Perform page breaks

                Chapter 7                 2
7
  Understanding Control Break Logic

• A control break is a temporary detour in the logic
  of a program
• Programmers refer to a program as a control
  break program when a change in the value of a
  variable initiates special actions or causes
  special or unusual processing to occur
• If you have ever read a report that lists items in
  groups with each group followed by a subtotal,
  then you have read a type of control break report


                 Chapter 7               3
7
  Understanding Control Break Logic

• Some other examples of control break reports
  produced by control break programs include:
   – All employees listed in order by department number, in
     which a new page starts for each department
   – All company clients listed in order by state of residence,
     with a count of clients after each state’s client list
   – All books for sale in a bookstore in order by category
     with a dollar total for the value of all books following
     each category of book
   – All items sold in order by date of sale, switching ink
     color for each new month

                    Chapter 7                    4
7
  Understanding Control Break Logic

• Each of these reports shares two traits:
   – The records used in each report are listed in order by a
     specific variable: department, state, category, or date

   – When that variable changes, the program takes special
     action: starts a new page, prints a count or total, or
     switches ink color

• To generate a control break report, your input
  records must be organized in sorted order based
  on the field that will cause the breaks

                   Chapter 7                    5
7
           Performing Single-Level
               Control Breaks
• Figure 7-1 shows the input file description, from which you
  can see that the employee department is a two-digit
  numeric field and that the file has been presorted in
  employee-department number order




                   Chapter 7                   6
7
          Performing Single-Level
              Control Breaks
• Figure 7-2 shows the desired output—a simple list of
  employee names




                 Chapter 7                 7
7
         Performing Single-Level
             Control Breaks
• The technique you must use to “remember” the
  old department number is to create a special
  variable, called a control break field
• With a control break field, every time you read
  in a record and print it, you also can save the
  crucial part of the record that will signal the
  change or control the program break
• The housekeeping() module begins similarly
  to others you have seen

                Chapter 7              8
7
   Mainline Logic for
Employees by Department
    Report Program




     Chapter 7       9
7
          Performing Single-Level
              Control Breaks
• You declare variables as shown in Figure 7-4,
  including those you will use for the input data:
  empDept, empLast, and empFirst
• You can also declare variables to hold the
  headings, and an additional variable that is
  named oldDept
• Note that it would be incorrect to initialize
  oldDept to the value of empDept when you
  declare oldDept


                 Chapter 7               10
7
  housekeeping() Module
    for Employees by
Department Report Program




      Chapter 7      11
7
          Performing Single-Level
              Control Breaks
• The first task within the mainLoop() is to check
  whether the empDept holds the same value as
  oldDept
• For the first record, on the first pass through the
  mainLoop(), the values are equal; you set them to be
  equal in housekeeping()
• Therefore you proceed, printing the employee’s
  record and reading a second record
• At the end of the mainLoop() shown in Figure 7-5, the
  logical flow returns to the mainline logic shown in
  Figure 7-3
                  Chapter 7                12
7
 mainLoop() Module for
Employees by Department
    Report Program




     Chapter 7       13
7
         Performing Single-Level
             Control Breaks
• Eventually, you will read in an employee
  whose empDept is not the same as oldDept
• That’s when the control break routine,
  newPage(), executes
• The newPage() module must perform two
  tasks:
  – It must print headings on top of a new page
  – It must update the control break field


                 Chapter 7                   14
7
  The newPage() Module
    for Employees by
Department Report Program




      Chapter 7      15
7
           Performing Single-Level
               Control Breaks
• The newPage() module performs two tasks
  required in all control break routines:

   – Performs any necessary processing for the new group—
     in this case, writes headings

   – Updates the control break field

• The finish() module for the Employees by
  Department report program requires only that you
  close the files as shown in Figure 7-7

                   Chapter 7               16
7
 The finish() Module for
Employees by Department
    Report Program




     Chapter 7        17
7
         Using Control Data within
         the Control Break Module
• In the Employees by Department report program
  example, the control break routine printed
  constant headings at the top of each new page,
  but sometimes you need to use control data
  within a control break module
• The difference between Figure 7-2 and Figure 7-8
  lies in the heading
• Figure 7-8 shows variable data in the heading—
  the department number prints at the top of each
  page of employees

                Chapter 7              18
7
          Using Control Data within
          the Control Break Module




• To create this kind of program, the one change you must
  make in the existing program is to modify the newPage()
  module as shown in Figure 7-9
• A message that prints at the end of a page is called a footer

                    Chapter 7                    19
7
       Modified newPage() Module
         that Prints Department
           Number in Heading
• Figure 7-11
  shows the
  newPage()
  module required
  to print the
  department
  number in an
  Employees by
  Department
  report footer

                Chapter 7    20
7
            Using Control Data within
            the Control Break Module




•   The newPage() module has three tasks:
    – It must print the footer for the previous department at the bottom of the
      employee list
    – It must print headings on top of a new page
    – It must update the control break field


                        Chapter 7                           21
7
          Using Control Data within
          the Control Break Module
• Now the newPage() module performs three tasks
  required in all control break routines:
   – It performs any necessary processing for the previous
     group—in this case, writes the footer

   – It performs any necessary processing for the new group
     —in this case, writes headings

   – It updates the control break field

• The finish() module for the new program
  containing footers also requires an extra step
                   Chapter 7                  22
7
    Modified newPage()
    Module that Prints
Department Number in Footer




       Chapter 7       23
7
    Modified finish() Module
for Report Program with Footer




        Chapter 7        24
7
Performing Control Breaks with Totals

• Suppose you run a bookstore, and one of the files you
  maintain is called BOOKFILE that has one record for every
  book title that you carry
• Each record has fields such as bookTitle, bookAuthor,
  bookCategory, as shown in Figure 7-13




                   Chapter 7                  25
7
Performing Control Breaks with Totals

• Suppose you want to print out a list of all the books that
  your store carries with a total number of books at the
  bottom of the list, as shown in Figure 7-14




                    Chapter 7                    26
7
Flowchart and Pseudocode
  for Bookstore Program




   Chapter 7       27
7
Flowchart and Pseudocode
  for Bookstore Program




   Chapter 7       28
7
Performing Control Breaks with Totals

•   As you can see from the pseudocode in Figure 7-15, the
    bookListLoop() module performs three major tasks:
    1. Prints a book title
    2. Adds 1 to the grandTotal
    3. Reads in the next book record
•   The closeDown() module prints the grandTotal
•   You can’t print grandTotal any earlier in the program
    because the grandTotal value isn’t complete until the
    last record has been read
•   At some point the bookCategory for an input record
    does not match the previousCategory

                       Chapter 7             29
7
Flowchart and Pseudocode
  for Bookstore Program
       with Subtotals




    Chapter 7        30
7
Flowchart and Pseudocode
  for Bookstore Program
       with Subtotals




    Chapter 7        31
7
Performing Control Breaks with Totals

• At that point, you perform the categoryChange() module
• Within the categoryChange() module, you print the count
  of the previousCategory of books
• Then you add the categoryTotal to the grandTotal
• Adding a total to a higher-level total is called rolling up the
  totals
• You could write the bookListLoop() so that as you
  process each book, you add one to the categoryTotal
  and add one to the grandTotal
• Then there would be no need to roll totals up in the
  categoryChange() module

                     Chapter 7                     32
7
Performing Control Breaks with Totals

• This control break report containing totals performs four
  of the five tasks required in all control break routines
  that include totals:
   – It performs any necessary processing for the previous group—in
     this case it prints the categoryTotal
   – It rolls up the current level totals to the next higher level—in this
     case it adds categoryTotal to grandTotal
   – It resets the current level’s totals to zero—in this case the
     categoryTotal is set to zero
   – It performs any necessary processing for the new group—in this
     case there is none
   – It updates the control break field—in this case
     previousCategory



                       Chapter 7                          33
7
           Performing Multiple-Level
                Control Breaks
• Let’s say your bookstore from the last example is
  so successful that you have a chain of them
  across the country
• You would like a report that prints a summary of
  books sold in each city and each state, similar to
  the one shown in Figure 7-17
• A report such as this one that does not include
  any information about individual records, but
  instead includes group totals, is a summary
  report

                 Chapter 7               34
7
         Performing Multiple-Level
              Control Breaks
• This program
  contains a multiple-
  level control break,
  that is, the normal
  flow of control
  (reading records and
  counting book sales)
  breaks away to print
  totals in response to
  more than just one
  change in condition


                 Chapter 7     35
Flowchart for housekeeping()     7
      Module for Book Sales
by City and State Report Program




       Chapter 7         36
Pseudocode for housekeeping()     7
      Module for Book Sales
by City and State Report Program




      Chapter 7         37
7
    Sample Data for Book
Sales by City and State Report




        Chapter 7        38
7
         Performing Multiple-Level
              Control Breaks
• Because cities in different states can have the same
  name, writing your control break program to check for a
  change in city first, causes your program to not
  recognize that you are working with a new city
• Instead, you should always check for a major-level break
  first
• If the records are sorted by bookCity within bookState,
  then a change in bookState causes a major-level break
  and change in bookCity causes a minor-level break
• Figure 7-20 shows the mainLoop() for the Book Sales
  by City and State Report program

                  Chapter 7                  39
Flowchart and Pseudocode for     7
    mainLoop() for Book
Sales by City and State Report




     Chapter 7          40
7
Flowchart and Pseudocode
  for stateBreak() Module




    Chapter 7       41
7
Flowchart and Pseudocode
   for cityBreak() Module




    Chapter 7       42
7
Flowchart and Pseudocode
  for closeDown() Module




    Chapter 7       43
7
            Performing Multiple-Level
                 Control Breaks
• Every time you write a program, where you need control
  break routines, you should check whether you need to
  complete each of the following tasks within the modules:
   – Perform the lower-level break, if any
   – Perform any control break processing for the previous
     group
   – Roll up the current level totals to the next higher level
   – Reset the current level’s totals to zero
   – Perform any control break processing for the new group
   – Update the control break field

                     Chapter 7                      44
7
         Performing Page Breaks

• Many business programs use a control break to
  start a new page when a printed page fills up with
  output
• The logic in these programs involves counting
  the lines printed, pausing to print headings when
  the counter reaches some predetermined valued,
  and then going on
• Let’s say you have a file called CUSTOMERFILE
  that contains 1,000 customers with two character
  fields that you have decided to call custLast and
  custFirst

                Chapter 7               45
7
              Performing Page Breaks
•   You want to print a list of these customers, 60 detail lines to a
    page
•   The mainline logic for the program is familiar
•   The only new feature is variable called a line counter
•   You will use a line-counter variable to keep track of the number of
    printed lines so that you can break to a new page after printing 60
    lines, as shown in Figure 7-24




                        Chapter 7                        46
7
Performing Page Breaks




    Chapter 7       47
7
           Performing Page Breaks
• The startNewPage() module must print the headings that
  appear at the top of a new page, and it must also set the
  lineCounter back to zero
• The startNewPage() module is simpler than many control
  break modules because no record counters or
  accumulators are being maintained




                   Chapter 7                  48
7
             Performing Page Breaks
• In fact, the startNewPage() module must perform only two
  of the tasks you have seen required by control break
  routines
   – It does not perform the lower-level break, because there is none
   – It does not perform any control break processing for the previous
     group, because there is none
   – It does not roll up the current totals to the next higher level,
     because there are no totals
   – It does not reset the current level’s totals to zero, because there
     are no totals (other than the lineCounter, which is the control
     break field)
   – It does perform control break processing for the new group by
     writing headings at the top of the new page
   – It does update the control break field—the line counter

                       Chapter 7                          49
7
                     Summary
• A control break is a temporary detour in the logic of a
  program; programmers refer to a program as a control
  break program when a change in the value of a
  variable initiates special actions or causes special or
  unusual processing to occur
• You use a control break field to hold data from a
  previous record
• Sometimes you need to use control data within a
  control break module, such as in a heading that
  requires information about the next record or in a
  footer that requires information about the previous
  record
                  Chapter 7                 50
7
                    Summary

• A control break report that contains and prints
  totals for the previous group, rolls up the current
  level totals to the next higher level, resets the
  current level’s totals to zero, performs any other
  needed control break processing, and updates
  the control break field

• In a program containing a multiple-level control
  break, the normal flow of control breaks away for
  special processing in response to more than just
  one change in condition

                 Chapter 7               51
7
                 Summary

• To perform page breaks, you count the lines
  printed and pause to print headings when the
  counter reaches some predetermined value




              Chapter 7             52

More Related Content

What's hot

SAP Variant Configuration example by KMR software
SAP Variant Configuration example by KMR softwareSAP Variant Configuration example by KMR software
SAP Variant Configuration example by KMR software
KMR SOFTWARE SERVICES PVT LTD
 
Copa configuration
Copa configurationCopa configuration
Copa configurationMithun Roy
 
Db2 for z os trends
Db2 for z os trendsDb2 for z os trends
Db2 for z os trends
Cuneyt Goksu
 
R12 Oracle Inventory Management, New Features
R12 Oracle Inventory Management, New FeaturesR12 Oracle Inventory Management, New Features
R12 Oracle Inventory Management, New Features
iWare Logic Technologies Pvt. Ltd.
 
Preventing Database Perfomance Issues | DB Optimizer
Preventing Database Perfomance Issues | DB OptimizerPreventing Database Perfomance Issues | DB Optimizer
Preventing Database Perfomance Issues | DB Optimizer
Michael Findling
 
Quattor
QuattorQuattor
Quattor
Inria
 
Workbench and customising request
Workbench and customising requestWorkbench and customising request
Workbench and customising request
lakshmi rajkumar
 
Minimum Part Setup
Minimum Part SetupMinimum Part Setup
Minimum Part Setupsarafletcher
 

What's hot (9)

SAP Variant Configuration example by KMR software
SAP Variant Configuration example by KMR softwareSAP Variant Configuration example by KMR software
SAP Variant Configuration example by KMR software
 
Copa configuration
Copa configurationCopa configuration
Copa configuration
 
Db2 for z os trends
Db2 for z os trendsDb2 for z os trends
Db2 for z os trends
 
Lecture28
Lecture28Lecture28
Lecture28
 
R12 Oracle Inventory Management, New Features
R12 Oracle Inventory Management, New FeaturesR12 Oracle Inventory Management, New Features
R12 Oracle Inventory Management, New Features
 
Preventing Database Perfomance Issues | DB Optimizer
Preventing Database Perfomance Issues | DB OptimizerPreventing Database Perfomance Issues | DB Optimizer
Preventing Database Perfomance Issues | DB Optimizer
 
Quattor
QuattorQuattor
Quattor
 
Workbench and customising request
Workbench and customising requestWorkbench and customising request
Workbench and customising request
 
Minimum Part Setup
Minimum Part SetupMinimum Part Setup
Minimum Part Setup
 

Viewers also liked

EOS Implementer - 10 Reasons to Hire a Professional
EOS Implementer - 10 Reasons to Hire a ProfessionalEOS Implementer - 10 Reasons to Hire a Professional
EOS Implementer - 10 Reasons to Hire a Professional
Traction Masters
 
EOS Prospect (Target Market): What Makes a Good One?
EOS Prospect (Target Market): What Makes a Good One?EOS Prospect (Target Market): What Makes a Good One?
EOS Prospect (Target Market): What Makes a Good One?
Traction Masters
 
10 Ways to Growth Hack Your Startup in Singapore
10 Ways to Growth Hack Your Startup in Singapore10 Ways to Growth Hack Your Startup in Singapore
10 Ways to Growth Hack Your Startup in Singapore
Happy Marketer
 
Growth Hack Your Way to Startup Traction by @rocketshp
Growth Hack Your Way to Startup Traction by @rocketshpGrowth Hack Your Way to Startup Traction by @rocketshp
Growth Hack Your Way to Startup Traction by @rocketshp
Rocketshp
 
Zero to One - Book Summary Report
Zero to One - Book Summary ReportZero to One - Book Summary Report
Zero to One - Book Summary Report
Corey O'Neal
 
How to Grow & Gain Traction
How to Grow & Gain TractionHow to Grow & Gain Traction
How to Grow & Gain Traction
Erik Bernskiöld
 
Entrepreneurial Operating System (EOS): Model and Process
Entrepreneurial Operating System (EOS): Model and ProcessEntrepreneurial Operating System (EOS): Model and Process
Entrepreneurial Operating System (EOS): Model and ProcessTraction Masters
 
Creative Traction Methodology - For Early Stage Startups
Creative Traction Methodology - For Early Stage StartupsCreative Traction Methodology - For Early Stage Startups
Creative Traction Methodology - For Early Stage Startups
Tommaso Di Bartolo
 
Build Features, Not Apps
Build Features, Not AppsBuild Features, Not Apps
Build Features, Not Apps
Natasha Murashev
 

Viewers also liked (10)

HDF-EOS Tools
HDF-EOS ToolsHDF-EOS Tools
HDF-EOS Tools
 
EOS Implementer - 10 Reasons to Hire a Professional
EOS Implementer - 10 Reasons to Hire a ProfessionalEOS Implementer - 10 Reasons to Hire a Professional
EOS Implementer - 10 Reasons to Hire a Professional
 
EOS Prospect (Target Market): What Makes a Good One?
EOS Prospect (Target Market): What Makes a Good One?EOS Prospect (Target Market): What Makes a Good One?
EOS Prospect (Target Market): What Makes a Good One?
 
10 Ways to Growth Hack Your Startup in Singapore
10 Ways to Growth Hack Your Startup in Singapore10 Ways to Growth Hack Your Startup in Singapore
10 Ways to Growth Hack Your Startup in Singapore
 
Growth Hack Your Way to Startup Traction by @rocketshp
Growth Hack Your Way to Startup Traction by @rocketshpGrowth Hack Your Way to Startup Traction by @rocketshp
Growth Hack Your Way to Startup Traction by @rocketshp
 
Zero to One - Book Summary Report
Zero to One - Book Summary ReportZero to One - Book Summary Report
Zero to One - Book Summary Report
 
How to Grow & Gain Traction
How to Grow & Gain TractionHow to Grow & Gain Traction
How to Grow & Gain Traction
 
Entrepreneurial Operating System (EOS): Model and Process
Entrepreneurial Operating System (EOS): Model and ProcessEntrepreneurial Operating System (EOS): Model and Process
Entrepreneurial Operating System (EOS): Model and Process
 
Creative Traction Methodology - For Early Stage Startups
Creative Traction Methodology - For Early Stage StartupsCreative Traction Methodology - For Early Stage Startups
Creative Traction Methodology - For Early Stage Startups
 
Build Features, Not Apps
Build Features, Not AppsBuild Features, Not Apps
Build Features, Not Apps
 

Similar to 07 chapter

[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (1/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (1/3)[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (1/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (1/3)Carles Farré
 
Presentation v mware roi tco calculator
Presentation   v mware roi tco calculatorPresentation   v mware roi tco calculator
Presentation v mware roi tco calculator
solarisyourep
 
Improve datacenter energy efficiency with Intel Node Manager
Improve datacenter energy efficiency with Intel Node ManagerImprove datacenter energy efficiency with Intel Node Manager
Improve datacenter energy efficiency with Intel Node Manager
Principled Technologies
 
CASE STUDY InternetExcel Exercises, page 434, textRecord your.docx
CASE STUDY InternetExcel Exercises, page 434, textRecord your.docxCASE STUDY InternetExcel Exercises, page 434, textRecord your.docx
CASE STUDY InternetExcel Exercises, page 434, textRecord your.docx
keturahhazelhurst
 
Designing For Occasionally Connected Apps Slideshare
Designing For Occasionally Connected Apps SlideshareDesigning For Occasionally Connected Apps Slideshare
Designing For Occasionally Connected Apps Slideshare
Dean Willson
 
Release 12 features work arounds and Upgrade
Release 12 features work arounds and UpgradeRelease 12 features work arounds and Upgrade
Release 12 features work arounds and UpgradePrasad Gudipaty M.S., PMP
 
Prg 211 prg211
Prg 211 prg211Prg 211 prg211
Prg 211 prg211
GOODCourseHelp
 
User exits
User exitsUser exits
User exits
anilkv29
 
Designer 2000 Tuning
Designer 2000 TuningDesigner 2000 Tuning
Designer 2000 Tuning
Mahesh Vallampati
 
Abap for sd consultatnt
Abap for sd consultatntAbap for sd consultatnt
Abap for sd consultatnt
Sukumar Manickam
 
Software reengineering
Software reengineeringSoftware reengineering
Software reengineering
gourav kottawar
 
making_changes_m1_v4a.pdf
making_changes_m1_v4a.pdfmaking_changes_m1_v4a.pdf
making_changes_m1_v4a.pdf
Saikiran336411
 
EMC Documentum xCP 2.2 Self Paced Tutorial v1.0
EMC Documentum xCP 2.2 Self Paced Tutorial v1.0EMC Documentum xCP 2.2 Self Paced Tutorial v1.0
EMC Documentum xCP 2.2 Self Paced Tutorial v1.0
Haytham Ghandour
 
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docx
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docxStudent Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docx
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docx
emelyvalg9
 
Magento Imagine 2011 - Magento Debugging - Erik Hansen, Classy Llama Studios
Magento Imagine 2011 - Magento Debugging - Erik Hansen, Classy Llama StudiosMagento Imagine 2011 - Magento Debugging - Erik Hansen, Classy Llama Studios
Magento Imagine 2011 - Magento Debugging - Erik Hansen, Classy Llama StudiosErik Hansen
 
Common Redirection Mechanism
Common Redirection MechanismCommon Redirection Mechanism
Common Redirection MechanismRoman Agaev
 
PlmJobManager NX Refile Presentation english
PlmJobManager NX Refile Presentation englishPlmJobManager NX Refile Presentation english
PlmJobManager NX Refile Presentation english
addPLM
 
JavaOne2013: Implement a High Level Parallel API - Richard Ning
JavaOne2013: Implement a High Level Parallel API - Richard NingJavaOne2013: Implement a High Level Parallel API - Richard Ning
JavaOne2013: Implement a High Level Parallel API - Richard Ning
Chris Bailey
 

Similar to 07 chapter (20)

[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (1/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (1/3)[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (1/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (1/3)
 
Presentation v mware roi tco calculator
Presentation   v mware roi tco calculatorPresentation   v mware roi tco calculator
Presentation v mware roi tco calculator
 
Improve datacenter energy efficiency with Intel Node Manager
Improve datacenter energy efficiency with Intel Node ManagerImprove datacenter energy efficiency with Intel Node Manager
Improve datacenter energy efficiency with Intel Node Manager
 
Lab3 RTC Source Control
Lab3 RTC Source ControlLab3 RTC Source Control
Lab3 RTC Source Control
 
CASE STUDY InternetExcel Exercises, page 434, textRecord your.docx
CASE STUDY InternetExcel Exercises, page 434, textRecord your.docxCASE STUDY InternetExcel Exercises, page 434, textRecord your.docx
CASE STUDY InternetExcel Exercises, page 434, textRecord your.docx
 
Designing For Occasionally Connected Apps Slideshare
Designing For Occasionally Connected Apps SlideshareDesigning For Occasionally Connected Apps Slideshare
Designing For Occasionally Connected Apps Slideshare
 
Release 12 features work arounds and Upgrade
Release 12 features work arounds and UpgradeRelease 12 features work arounds and Upgrade
Release 12 features work arounds and Upgrade
 
Prg 211 prg211
Prg 211 prg211Prg 211 prg211
Prg 211 prg211
 
User exits
User exitsUser exits
User exits
 
Designer 2000 Tuning
Designer 2000 TuningDesigner 2000 Tuning
Designer 2000 Tuning
 
Abap for sd consultatnt
Abap for sd consultatntAbap for sd consultatnt
Abap for sd consultatnt
 
Software reengineering
Software reengineeringSoftware reengineering
Software reengineering
 
Bdc
BdcBdc
Bdc
 
making_changes_m1_v4a.pdf
making_changes_m1_v4a.pdfmaking_changes_m1_v4a.pdf
making_changes_m1_v4a.pdf
 
EMC Documentum xCP 2.2 Self Paced Tutorial v1.0
EMC Documentum xCP 2.2 Self Paced Tutorial v1.0EMC Documentum xCP 2.2 Self Paced Tutorial v1.0
EMC Documentum xCP 2.2 Self Paced Tutorial v1.0
 
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docx
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docxStudent Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docx
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docx
 
Magento Imagine 2011 - Magento Debugging - Erik Hansen, Classy Llama Studios
Magento Imagine 2011 - Magento Debugging - Erik Hansen, Classy Llama StudiosMagento Imagine 2011 - Magento Debugging - Erik Hansen, Classy Llama Studios
Magento Imagine 2011 - Magento Debugging - Erik Hansen, Classy Llama Studios
 
Common Redirection Mechanism
Common Redirection MechanismCommon Redirection Mechanism
Common Redirection Mechanism
 
PlmJobManager NX Refile Presentation english
PlmJobManager NX Refile Presentation englishPlmJobManager NX Refile Presentation english
PlmJobManager NX Refile Presentation english
 
JavaOne2013: Implement a High Level Parallel API - Richard Ning
JavaOne2013: Implement a High Level Parallel API - Richard NingJavaOne2013: Implement a High Level Parallel API - Richard Ning
JavaOne2013: Implement a High Level Parallel API - Richard Ning
 

Recently uploaded

一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理
n0tivyq
 
一比一原版(LSE毕业证书)伦敦政治经济学院毕业证成绩单如何办理
一比一原版(LSE毕业证书)伦敦政治经济学院毕业证成绩单如何办理一比一原版(LSE毕业证书)伦敦政治经济学院毕业证成绩单如何办理
一比一原版(LSE毕业证书)伦敦政治经济学院毕业证成绩单如何办理
jyz59f4j
 
Research 20 slides Amelia gavryliuks.pdf
Research 20 slides Amelia gavryliuks.pdfResearch 20 slides Amelia gavryliuks.pdf
Research 20 slides Amelia gavryliuks.pdf
ameli25062005
 
Expert Accessory Dwelling Unit (ADU) Drafting Services
Expert Accessory Dwelling Unit (ADU) Drafting ServicesExpert Accessory Dwelling Unit (ADU) Drafting Services
Expert Accessory Dwelling Unit (ADU) Drafting Services
ResDraft
 
一比一原版(UNUK毕业证书)诺丁汉大学毕业证如何办理
一比一原版(UNUK毕业证书)诺丁汉大学毕业证如何办理一比一原版(UNUK毕业证书)诺丁汉大学毕业证如何办理
一比一原版(UNUK毕业证书)诺丁汉大学毕业证如何办理
7sd8fier
 
Borys Sutkowski portfolio interior design
Borys Sutkowski portfolio interior designBorys Sutkowski portfolio interior design
Borys Sutkowski portfolio interior design
boryssutkowski
 
一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理
一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理
一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理
9a93xvy
 
Design Thinking Design thinking Design thinking
Design Thinking Design thinking Design thinkingDesign Thinking Design thinking Design thinking
Design Thinking Design thinking Design thinking
cy0krjxt
 
一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理
一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理
一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理
7sd8fier
 
Design Thinking Design thinking Design thinking
Design Thinking Design thinking Design thinkingDesign Thinking Design thinking Design thinking
Design Thinking Design thinking Design thinking
cy0krjxt
 
一比一原版(UCB毕业证书)伯明翰大学学院毕业证成绩单如何办理
一比一原版(UCB毕业证书)伯明翰大学学院毕业证成绩单如何办理一比一原版(UCB毕业证书)伯明翰大学学院毕业证成绩单如何办理
一比一原版(UCB毕业证书)伯明翰大学学院毕业证成绩单如何办理
h7j5io0
 
Book Formatting: Quality Control Checks for Designers
Book Formatting: Quality Control Checks for DesignersBook Formatting: Quality Control Checks for Designers
Book Formatting: Quality Control Checks for Designers
Confidence Ago
 
RTUYUIJKLDSADAGHBDJNKSMAL,D
RTUYUIJKLDSADAGHBDJNKSMAL,DRTUYUIJKLDSADAGHBDJNKSMAL,D
RTUYUIJKLDSADAGHBDJNKSMAL,D
cy0krjxt
 
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdf
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdfPORTFOLIO FABIANA VILLANI ARCHITECTURE.pdf
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdf
fabianavillanib
 
一比一原版(Bristol毕业证书)布里斯托大学毕业证成绩单如何办理
一比一原版(Bristol毕业证书)布里斯托大学毕业证成绩单如何办理一比一原版(Bristol毕业证书)布里斯托大学毕业证成绩单如何办理
一比一原版(Bristol毕业证书)布里斯托大学毕业证成绩单如何办理
smpc3nvg
 
一比一原版(MMU毕业证书)曼彻斯特城市大学毕业证成绩单如何办理
一比一原版(MMU毕业证书)曼彻斯特城市大学毕业证成绩单如何办理一比一原版(MMU毕业证书)曼彻斯特城市大学毕业证成绩单如何办理
一比一原版(MMU毕业证书)曼彻斯特城市大学毕业证成绩单如何办理
7sd8fier
 
一比一原版(BU毕业证书)伯恩茅斯大学毕业证成绩单如何办理
一比一原版(BU毕业证书)伯恩茅斯大学毕业证成绩单如何办理一比一原版(BU毕业证书)伯恩茅斯大学毕业证成绩单如何办理
一比一原版(BU毕业证书)伯恩茅斯大学毕业证成绩单如何办理
h7j5io0
 
Top 5 Indian Style Modular Kitchen Designs
Top 5 Indian Style Modular Kitchen DesignsTop 5 Indian Style Modular Kitchen Designs
Top 5 Indian Style Modular Kitchen Designs
Finzo Kitchens
 
20 slides of research movie and artists .pdf
20 slides of research movie and artists .pdf20 slides of research movie and artists .pdf
20 slides of research movie and artists .pdf
ameli25062005
 
一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理
一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理
一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理
smpc3nvg
 

Recently uploaded (20)

一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理
 
一比一原版(LSE毕业证书)伦敦政治经济学院毕业证成绩单如何办理
一比一原版(LSE毕业证书)伦敦政治经济学院毕业证成绩单如何办理一比一原版(LSE毕业证书)伦敦政治经济学院毕业证成绩单如何办理
一比一原版(LSE毕业证书)伦敦政治经济学院毕业证成绩单如何办理
 
Research 20 slides Amelia gavryliuks.pdf
Research 20 slides Amelia gavryliuks.pdfResearch 20 slides Amelia gavryliuks.pdf
Research 20 slides Amelia gavryliuks.pdf
 
Expert Accessory Dwelling Unit (ADU) Drafting Services
Expert Accessory Dwelling Unit (ADU) Drafting ServicesExpert Accessory Dwelling Unit (ADU) Drafting Services
Expert Accessory Dwelling Unit (ADU) Drafting Services
 
一比一原版(UNUK毕业证书)诺丁汉大学毕业证如何办理
一比一原版(UNUK毕业证书)诺丁汉大学毕业证如何办理一比一原版(UNUK毕业证书)诺丁汉大学毕业证如何办理
一比一原版(UNUK毕业证书)诺丁汉大学毕业证如何办理
 
Borys Sutkowski portfolio interior design
Borys Sutkowski portfolio interior designBorys Sutkowski portfolio interior design
Borys Sutkowski portfolio interior design
 
一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理
一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理
一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理
 
Design Thinking Design thinking Design thinking
Design Thinking Design thinking Design thinkingDesign Thinking Design thinking Design thinking
Design Thinking Design thinking Design thinking
 
一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理
一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理
一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理
 
Design Thinking Design thinking Design thinking
Design Thinking Design thinking Design thinkingDesign Thinking Design thinking Design thinking
Design Thinking Design thinking Design thinking
 
一比一原版(UCB毕业证书)伯明翰大学学院毕业证成绩单如何办理
一比一原版(UCB毕业证书)伯明翰大学学院毕业证成绩单如何办理一比一原版(UCB毕业证书)伯明翰大学学院毕业证成绩单如何办理
一比一原版(UCB毕业证书)伯明翰大学学院毕业证成绩单如何办理
 
Book Formatting: Quality Control Checks for Designers
Book Formatting: Quality Control Checks for DesignersBook Formatting: Quality Control Checks for Designers
Book Formatting: Quality Control Checks for Designers
 
RTUYUIJKLDSADAGHBDJNKSMAL,D
RTUYUIJKLDSADAGHBDJNKSMAL,DRTUYUIJKLDSADAGHBDJNKSMAL,D
RTUYUIJKLDSADAGHBDJNKSMAL,D
 
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdf
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdfPORTFOLIO FABIANA VILLANI ARCHITECTURE.pdf
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdf
 
一比一原版(Bristol毕业证书)布里斯托大学毕业证成绩单如何办理
一比一原版(Bristol毕业证书)布里斯托大学毕业证成绩单如何办理一比一原版(Bristol毕业证书)布里斯托大学毕业证成绩单如何办理
一比一原版(Bristol毕业证书)布里斯托大学毕业证成绩单如何办理
 
一比一原版(MMU毕业证书)曼彻斯特城市大学毕业证成绩单如何办理
一比一原版(MMU毕业证书)曼彻斯特城市大学毕业证成绩单如何办理一比一原版(MMU毕业证书)曼彻斯特城市大学毕业证成绩单如何办理
一比一原版(MMU毕业证书)曼彻斯特城市大学毕业证成绩单如何办理
 
一比一原版(BU毕业证书)伯恩茅斯大学毕业证成绩单如何办理
一比一原版(BU毕业证书)伯恩茅斯大学毕业证成绩单如何办理一比一原版(BU毕业证书)伯恩茅斯大学毕业证成绩单如何办理
一比一原版(BU毕业证书)伯恩茅斯大学毕业证成绩单如何办理
 
Top 5 Indian Style Modular Kitchen Designs
Top 5 Indian Style Modular Kitchen DesignsTop 5 Indian Style Modular Kitchen Designs
Top 5 Indian Style Modular Kitchen Designs
 
20 slides of research movie and artists .pdf
20 slides of research movie and artists .pdf20 slides of research movie and artists .pdf
20 slides of research movie and artists .pdf
 
一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理
一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理
一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理
 

07 chapter

  • 1. 7 Control Breaks Programming Logic and Design, Second Edition, Comprehensive Chapter 7 1
  • 2. 7 Objectives • After studying Chapter 7, you should be able to: • Understand control break logic • Perform single-level control breaks • Use control data within the control break module • Perform control breaks with totals • Perform multiple-level control breaks • Perform page breaks Chapter 7 2
  • 3. 7 Understanding Control Break Logic • A control break is a temporary detour in the logic of a program • Programmers refer to a program as a control break program when a change in the value of a variable initiates special actions or causes special or unusual processing to occur • If you have ever read a report that lists items in groups with each group followed by a subtotal, then you have read a type of control break report Chapter 7 3
  • 4. 7 Understanding Control Break Logic • Some other examples of control break reports produced by control break programs include: – All employees listed in order by department number, in which a new page starts for each department – All company clients listed in order by state of residence, with a count of clients after each state’s client list – All books for sale in a bookstore in order by category with a dollar total for the value of all books following each category of book – All items sold in order by date of sale, switching ink color for each new month Chapter 7 4
  • 5. 7 Understanding Control Break Logic • Each of these reports shares two traits: – The records used in each report are listed in order by a specific variable: department, state, category, or date – When that variable changes, the program takes special action: starts a new page, prints a count or total, or switches ink color • To generate a control break report, your input records must be organized in sorted order based on the field that will cause the breaks Chapter 7 5
  • 6. 7 Performing Single-Level Control Breaks • Figure 7-1 shows the input file description, from which you can see that the employee department is a two-digit numeric field and that the file has been presorted in employee-department number order Chapter 7 6
  • 7. 7 Performing Single-Level Control Breaks • Figure 7-2 shows the desired output—a simple list of employee names Chapter 7 7
  • 8. 7 Performing Single-Level Control Breaks • The technique you must use to “remember” the old department number is to create a special variable, called a control break field • With a control break field, every time you read in a record and print it, you also can save the crucial part of the record that will signal the change or control the program break • The housekeeping() module begins similarly to others you have seen Chapter 7 8
  • 9. 7 Mainline Logic for Employees by Department Report Program Chapter 7 9
  • 10. 7 Performing Single-Level Control Breaks • You declare variables as shown in Figure 7-4, including those you will use for the input data: empDept, empLast, and empFirst • You can also declare variables to hold the headings, and an additional variable that is named oldDept • Note that it would be incorrect to initialize oldDept to the value of empDept when you declare oldDept Chapter 7 10
  • 11. 7 housekeeping() Module for Employees by Department Report Program Chapter 7 11
  • 12. 7 Performing Single-Level Control Breaks • The first task within the mainLoop() is to check whether the empDept holds the same value as oldDept • For the first record, on the first pass through the mainLoop(), the values are equal; you set them to be equal in housekeeping() • Therefore you proceed, printing the employee’s record and reading a second record • At the end of the mainLoop() shown in Figure 7-5, the logical flow returns to the mainline logic shown in Figure 7-3 Chapter 7 12
  • 13. 7 mainLoop() Module for Employees by Department Report Program Chapter 7 13
  • 14. 7 Performing Single-Level Control Breaks • Eventually, you will read in an employee whose empDept is not the same as oldDept • That’s when the control break routine, newPage(), executes • The newPage() module must perform two tasks: – It must print headings on top of a new page – It must update the control break field Chapter 7 14
  • 15. 7 The newPage() Module for Employees by Department Report Program Chapter 7 15
  • 16. 7 Performing Single-Level Control Breaks • The newPage() module performs two tasks required in all control break routines: – Performs any necessary processing for the new group— in this case, writes headings – Updates the control break field • The finish() module for the Employees by Department report program requires only that you close the files as shown in Figure 7-7 Chapter 7 16
  • 17. 7 The finish() Module for Employees by Department Report Program Chapter 7 17
  • 18. 7 Using Control Data within the Control Break Module • In the Employees by Department report program example, the control break routine printed constant headings at the top of each new page, but sometimes you need to use control data within a control break module • The difference between Figure 7-2 and Figure 7-8 lies in the heading • Figure 7-8 shows variable data in the heading— the department number prints at the top of each page of employees Chapter 7 18
  • 19. 7 Using Control Data within the Control Break Module • To create this kind of program, the one change you must make in the existing program is to modify the newPage() module as shown in Figure 7-9 • A message that prints at the end of a page is called a footer Chapter 7 19
  • 20. 7 Modified newPage() Module that Prints Department Number in Heading • Figure 7-11 shows the newPage() module required to print the department number in an Employees by Department report footer Chapter 7 20
  • 21. 7 Using Control Data within the Control Break Module • The newPage() module has three tasks: – It must print the footer for the previous department at the bottom of the employee list – It must print headings on top of a new page – It must update the control break field Chapter 7 21
  • 22. 7 Using Control Data within the Control Break Module • Now the newPage() module performs three tasks required in all control break routines: – It performs any necessary processing for the previous group—in this case, writes the footer – It performs any necessary processing for the new group —in this case, writes headings – It updates the control break field • The finish() module for the new program containing footers also requires an extra step Chapter 7 22
  • 23. 7 Modified newPage() Module that Prints Department Number in Footer Chapter 7 23
  • 24. 7 Modified finish() Module for Report Program with Footer Chapter 7 24
  • 25. 7 Performing Control Breaks with Totals • Suppose you run a bookstore, and one of the files you maintain is called BOOKFILE that has one record for every book title that you carry • Each record has fields such as bookTitle, bookAuthor, bookCategory, as shown in Figure 7-13 Chapter 7 25
  • 26. 7 Performing Control Breaks with Totals • Suppose you want to print out a list of all the books that your store carries with a total number of books at the bottom of the list, as shown in Figure 7-14 Chapter 7 26
  • 27. 7 Flowchart and Pseudocode for Bookstore Program Chapter 7 27
  • 28. 7 Flowchart and Pseudocode for Bookstore Program Chapter 7 28
  • 29. 7 Performing Control Breaks with Totals • As you can see from the pseudocode in Figure 7-15, the bookListLoop() module performs three major tasks: 1. Prints a book title 2. Adds 1 to the grandTotal 3. Reads in the next book record • The closeDown() module prints the grandTotal • You can’t print grandTotal any earlier in the program because the grandTotal value isn’t complete until the last record has been read • At some point the bookCategory for an input record does not match the previousCategory Chapter 7 29
  • 30. 7 Flowchart and Pseudocode for Bookstore Program with Subtotals Chapter 7 30
  • 31. 7 Flowchart and Pseudocode for Bookstore Program with Subtotals Chapter 7 31
  • 32. 7 Performing Control Breaks with Totals • At that point, you perform the categoryChange() module • Within the categoryChange() module, you print the count of the previousCategory of books • Then you add the categoryTotal to the grandTotal • Adding a total to a higher-level total is called rolling up the totals • You could write the bookListLoop() so that as you process each book, you add one to the categoryTotal and add one to the grandTotal • Then there would be no need to roll totals up in the categoryChange() module Chapter 7 32
  • 33. 7 Performing Control Breaks with Totals • This control break report containing totals performs four of the five tasks required in all control break routines that include totals: – It performs any necessary processing for the previous group—in this case it prints the categoryTotal – It rolls up the current level totals to the next higher level—in this case it adds categoryTotal to grandTotal – It resets the current level’s totals to zero—in this case the categoryTotal is set to zero – It performs any necessary processing for the new group—in this case there is none – It updates the control break field—in this case previousCategory Chapter 7 33
  • 34. 7 Performing Multiple-Level Control Breaks • Let’s say your bookstore from the last example is so successful that you have a chain of them across the country • You would like a report that prints a summary of books sold in each city and each state, similar to the one shown in Figure 7-17 • A report such as this one that does not include any information about individual records, but instead includes group totals, is a summary report Chapter 7 34
  • 35. 7 Performing Multiple-Level Control Breaks • This program contains a multiple- level control break, that is, the normal flow of control (reading records and counting book sales) breaks away to print totals in response to more than just one change in condition Chapter 7 35
  • 36. Flowchart for housekeeping() 7 Module for Book Sales by City and State Report Program Chapter 7 36
  • 37. Pseudocode for housekeeping() 7 Module for Book Sales by City and State Report Program Chapter 7 37
  • 38. 7 Sample Data for Book Sales by City and State Report Chapter 7 38
  • 39. 7 Performing Multiple-Level Control Breaks • Because cities in different states can have the same name, writing your control break program to check for a change in city first, causes your program to not recognize that you are working with a new city • Instead, you should always check for a major-level break first • If the records are sorted by bookCity within bookState, then a change in bookState causes a major-level break and change in bookCity causes a minor-level break • Figure 7-20 shows the mainLoop() for the Book Sales by City and State Report program Chapter 7 39
  • 40. Flowchart and Pseudocode for 7 mainLoop() for Book Sales by City and State Report Chapter 7 40
  • 41. 7 Flowchart and Pseudocode for stateBreak() Module Chapter 7 41
  • 42. 7 Flowchart and Pseudocode for cityBreak() Module Chapter 7 42
  • 43. 7 Flowchart and Pseudocode for closeDown() Module Chapter 7 43
  • 44. 7 Performing Multiple-Level Control Breaks • Every time you write a program, where you need control break routines, you should check whether you need to complete each of the following tasks within the modules: – Perform the lower-level break, if any – Perform any control break processing for the previous group – Roll up the current level totals to the next higher level – Reset the current level’s totals to zero – Perform any control break processing for the new group – Update the control break field Chapter 7 44
  • 45. 7 Performing Page Breaks • Many business programs use a control break to start a new page when a printed page fills up with output • The logic in these programs involves counting the lines printed, pausing to print headings when the counter reaches some predetermined valued, and then going on • Let’s say you have a file called CUSTOMERFILE that contains 1,000 customers with two character fields that you have decided to call custLast and custFirst Chapter 7 45
  • 46. 7 Performing Page Breaks • You want to print a list of these customers, 60 detail lines to a page • The mainline logic for the program is familiar • The only new feature is variable called a line counter • You will use a line-counter variable to keep track of the number of printed lines so that you can break to a new page after printing 60 lines, as shown in Figure 7-24 Chapter 7 46
  • 47. 7 Performing Page Breaks Chapter 7 47
  • 48. 7 Performing Page Breaks • The startNewPage() module must print the headings that appear at the top of a new page, and it must also set the lineCounter back to zero • The startNewPage() module is simpler than many control break modules because no record counters or accumulators are being maintained Chapter 7 48
  • 49. 7 Performing Page Breaks • In fact, the startNewPage() module must perform only two of the tasks you have seen required by control break routines – It does not perform the lower-level break, because there is none – It does not perform any control break processing for the previous group, because there is none – It does not roll up the current totals to the next higher level, because there are no totals – It does not reset the current level’s totals to zero, because there are no totals (other than the lineCounter, which is the control break field) – It does perform control break processing for the new group by writing headings at the top of the new page – It does update the control break field—the line counter Chapter 7 49
  • 50. 7 Summary • A control break is a temporary detour in the logic of a program; programmers refer to a program as a control break program when a change in the value of a variable initiates special actions or causes special or unusual processing to occur • You use a control break field to hold data from a previous record • Sometimes you need to use control data within a control break module, such as in a heading that requires information about the next record or in a footer that requires information about the previous record Chapter 7 50
  • 51. 7 Summary • A control break report that contains and prints totals for the previous group, rolls up the current level totals to the next higher level, resets the current level’s totals to zero, performs any other needed control break processing, and updates the control break field • In a program containing a multiple-level control break, the normal flow of control breaks away for special processing in response to more than just one change in condition Chapter 7 51
  • 52. 7 Summary • To perform page breaks, you count the lines printed and pause to print headings when the counter reaches some predetermined value Chapter 7 52