The document discusses control break logic in programming. It explains that a control break is a temporary detour in a program's logic that is initiated by a change in a variable's value, causing special processing. It provides examples of control break reports and the key traits they share. The document then discusses how to program single-level control breaks with an example using employee department data. It explains using a control break field, main loop logic, and the newPage module to handle breaks. Finally, it discusses enhancing the program to include control data and totals in break processing.
Optimal query access plans are essential for good data server performance and it is the DB2 for Linux, UNIX and Windows query optimizer's job to choose the best access plan. However, occasionally queries that were performing well suddenly degrade, due to an unexpected access plan change. This presentation will cover a number of best practices to ensure that access plans don't unexpectedly change for the worse. All access plans can be made more stable with accurate DB statistics and proper DB configuration. DB2 9.7 provides a new feature to stabilize access plans for static SQL across binds and rebinds, which is particularly important for applications using SQL Procedural Language. When all else fails, optimization profiles can be used to force the desired access plan. This presentation will show you how to develop and implement a strategy to ensure your access plans are rock-solid.
[pdf presentation with notes]
Part 1 of this webinar set discussed the performance challenges caused by plan instability. Using SQL profiles and SQL patches are mechanisms that can provide targeted relief to individual SQL statements that have plan regressions. However, Oracle provides SQL Plan Management features that are intended to prevent plan regressions from creating challenges in the first place.
In this webinar, attendees will learn:
- How SQL Plan Management (SPM) works
- How SQL Plan Baselines are created
- How SQL Plan Baselines are evolved/enabled for use
- Limitations of SPM
Featured speaker: Karen Morton, Enkitec
Change Manager is a powerful set of tools for database administrators and developers to simplify and automate the database change management lifecycle.
Optimal query access plans are essential for good data server performance and it is the DB2 for Linux, UNIX and Windows query optimizer's job to choose the best access plan. However, occasionally queries that were performing well suddenly degrade, due to an unexpected access plan change. This presentation will cover a number of best practices to ensure that access plans don't unexpectedly change for the worse. All access plans can be made more stable with accurate DB statistics and proper DB configuration. DB2 9.7 provides a new feature to stabilize access plans for static SQL across binds and rebinds, which is particularly important for applications using SQL Procedural Language. When all else fails, optimization profiles can be used to force the desired access plan. This presentation will show you how to develop and implement a strategy to ensure your access plans are rock-solid.
[pdf presentation with notes]
Part 1 of this webinar set discussed the performance challenges caused by plan instability. Using SQL profiles and SQL patches are mechanisms that can provide targeted relief to individual SQL statements that have plan regressions. However, Oracle provides SQL Plan Management features that are intended to prevent plan regressions from creating challenges in the first place.
In this webinar, attendees will learn:
- How SQL Plan Management (SPM) works
- How SQL Plan Baselines are created
- How SQL Plan Baselines are evolved/enabled for use
- Limitations of SPM
Featured speaker: Karen Morton, Enkitec
Change Manager is a powerful set of tools for database administrators and developers to simplify and automate the database change management lifecycle.
To understand following features:
OPM Inventory conversion.
Material traceability: Enhanced material control
Dual UOM functionality.
Material Status control.
Advanced Lot control.
Lot indivisibility functionality.
Material aging workflow.
Preventing Database Perfomance Issues | DB OptimizerMichael Findling
DB Optimizer is designed for database performance tools that focus on what is happening in the database and fixing it, rather than preventing problems. DB Optimizer (particularly when used in conjunction with J Optimizer) will help to data management groups closer together anbd collaborate.
Quattor is an open-source tool aimed at efficient management of fabrics with hundred or thousand of Linux machines, still being easy enough to manage smaller clusters. It has been originally developed during the European Data Grid (EDG) project. It is now in use at more than 50 grid sites running gLite middleware, ranging from small EGEE/LCG T3 to very large one like CERN.
Quattor ability to factorize common part of description configuration and advanced features of PAN language used to do this description allowed to build and maintain a common set of templates that any site can just import and customize without editing them. This resulted in the so-called QWG templates, a complete set of standard templates to configure OS and gLite middleware. This results in a very efficient sharing of installation and configuration tasks around the world. This could be extended to many service configuration other than grid services and is already available for standard services like mail, web servers... with a support for configuring virtual machines.
This presentation, in addition to Quattor specific features, will introduce how the project is managed by the community and plans for the long-term sustainability of the product.
EOS Implementer - 10 Reasons to Hire a ProfessionalTraction Masters
EOS Implementers are experienced entrepreneurial leaders in their own right who have discovered EOS and dedicated themselves to helping other entrepreneurial leaders. Graduates of our intensive training program and part of a collaborative support network, Certified EOS Implementers are uniquely suited to teach, facilitate and coach leadership teams through The EOS Process.
Certified EOS Implementers are passionate about helping entrepreneurial organizations become the best they can be. A Certified EOS Implementer is an experienced entrepreneur who consistently displays the EOS Worldwide core values. We are people who:
are humbly confident – open, honest, real, and well-practiced, ready to make a positive difference
grow or die – driven to maximize every situation and to take ourselves and our clients to the next level
help first – subordinating our personal interests to advance others, always giving value before expecting anything in return
do the right thing – never betraying a trust and doing whatever it takes to resolve every issue so people can move forward
do what we say – sometimes more, never less
The 1st step taken by both our Professional and Certified EOS Implementers is completing our intense 3-Day Training for Professional Implementers, the Professional Implementer Boot Camp. They are also an involved member of the EOS Implementer Base Camp and they regularly sharpen their skills by participating in weekly and quarterly collaborative meetings with other Certified & Professional EOS Implementers.
To further distinguish themselves as an expert at delivering EOS, a Certified EOS Implementer is actively implementing EOS with a minimum of 5 clients at any given time. In addition to their active implementation their clients rate them above an 8.75 (on a scale of 1 – 10) for the results they help their clients achieve.
EOS Prospect (Target Market): What Makes a Good One?Traction Masters
The presentations provides an overview of the Entrepreneurial Operating System (EOS), the EOS Model, the EOS Process, EOS Target Market Clients, Common EOS Client Frustrations, the 5 Leadership Abilities, and an introduction to Jonathan Smith a Certified EOS Implementer.
EOS, the Entrepreneurial Operating System, is a set of timeless business principles and real-world tools that help Entrepreneurs get what they want from their businesses. By mastering this simple “way of operating,” leadership teams of growth-oriented companies systematically and permanently improve. EOS is a proven system with over 10 years of history and is in use in more than 610 companies. It consistently helps companies achieve more revenue growth and more profit, and also delivers a better balance of life to company owners and leaders.
EOS Model – A visual illustration of the Six Key Components.
EOS Process – A visual illustration of the proven process used by an EOS Implementer to help a leadership team master EOS.
Target Market – A clear definition of your organization’s ideal prospects. It defines the demographic profile (who are they?), the geographic profile (where are they?) and the psychographic profile (how do they think?) of those people or organizations most likely to become your best customers.
Hitting the Ceiling – The inevitable phenomenon of getting “stuck” during periods of growth and change. Leaders who master the Five Leadership Abilities become proficient at helping their companies, their departments, and even themselves break through the ceiling.
Five Leadership Abilities – Five essential skills that help leaders break through the inevitable ceilings they hit at three levels – organizationally, departmentally, and personally. The Leadership Abilities are - Simplify, Delegate, Predict, Systemize and Structure.
10 Ways to Growth Hack Your Startup in SingaporeHappy Marketer
It's challenging to scale up your startup if you're on a budget. That's why we've outlined 10 easy ways to growth hack your startup. Here's a cost-effective strategy to grow as a lean startup - that actually works!
Growth Hack Your Way to Startup Traction by @rocketshpRocketshp
Got $4,000 lying around and dying to grow your startup? Look no further, we share lesser-known methods to blast through obstacles and get traction fast. Dive in.
A lecture from the course "Entrepreneurship" at the Goethe University in Frankfurt am Main, Germany. The lecture covers how to get customers for your company, which marketing channels you should choose and how to use behavioral science to get ahead.
Creative Traction Methodology - For Early Stage StartupsTommaso Di Bartolo
How to build a mindset that gets a new product traction? 99% of all startups are forced to give up because they lack traction. As founders are thrilled and captivated to build a product that could change the world - the majority downright neglects to put equal efforts towards how to differentiate in taking the product to market. The difference between those who make it to get traction and the rest lies in the innovator’s mindset.
Managing power in the datacenter can be a good strategy to reduce power and cooling overheard while allowing servers operate at the most efficient power levels and do as much work as possible within your specific power policies.
We found that using Intel Node Manager to set power limits on servers running various workloads increased performance per watt by up to 42.8 percent compared to running the same workloads with no power management solution.
To understand following features:
OPM Inventory conversion.
Material traceability: Enhanced material control
Dual UOM functionality.
Material Status control.
Advanced Lot control.
Lot indivisibility functionality.
Material aging workflow.
Preventing Database Perfomance Issues | DB OptimizerMichael Findling
DB Optimizer is designed for database performance tools that focus on what is happening in the database and fixing it, rather than preventing problems. DB Optimizer (particularly when used in conjunction with J Optimizer) will help to data management groups closer together anbd collaborate.
Quattor is an open-source tool aimed at efficient management of fabrics with hundred or thousand of Linux machines, still being easy enough to manage smaller clusters. It has been originally developed during the European Data Grid (EDG) project. It is now in use at more than 50 grid sites running gLite middleware, ranging from small EGEE/LCG T3 to very large one like CERN.
Quattor ability to factorize common part of description configuration and advanced features of PAN language used to do this description allowed to build and maintain a common set of templates that any site can just import and customize without editing them. This resulted in the so-called QWG templates, a complete set of standard templates to configure OS and gLite middleware. This results in a very efficient sharing of installation and configuration tasks around the world. This could be extended to many service configuration other than grid services and is already available for standard services like mail, web servers... with a support for configuring virtual machines.
This presentation, in addition to Quattor specific features, will introduce how the project is managed by the community and plans for the long-term sustainability of the product.
EOS Implementer - 10 Reasons to Hire a ProfessionalTraction Masters
EOS Implementers are experienced entrepreneurial leaders in their own right who have discovered EOS and dedicated themselves to helping other entrepreneurial leaders. Graduates of our intensive training program and part of a collaborative support network, Certified EOS Implementers are uniquely suited to teach, facilitate and coach leadership teams through The EOS Process.
Certified EOS Implementers are passionate about helping entrepreneurial organizations become the best they can be. A Certified EOS Implementer is an experienced entrepreneur who consistently displays the EOS Worldwide core values. We are people who:
are humbly confident – open, honest, real, and well-practiced, ready to make a positive difference
grow or die – driven to maximize every situation and to take ourselves and our clients to the next level
help first – subordinating our personal interests to advance others, always giving value before expecting anything in return
do the right thing – never betraying a trust and doing whatever it takes to resolve every issue so people can move forward
do what we say – sometimes more, never less
The 1st step taken by both our Professional and Certified EOS Implementers is completing our intense 3-Day Training for Professional Implementers, the Professional Implementer Boot Camp. They are also an involved member of the EOS Implementer Base Camp and they regularly sharpen their skills by participating in weekly and quarterly collaborative meetings with other Certified & Professional EOS Implementers.
To further distinguish themselves as an expert at delivering EOS, a Certified EOS Implementer is actively implementing EOS with a minimum of 5 clients at any given time. In addition to their active implementation their clients rate them above an 8.75 (on a scale of 1 – 10) for the results they help their clients achieve.
EOS Prospect (Target Market): What Makes a Good One?Traction Masters
The presentations provides an overview of the Entrepreneurial Operating System (EOS), the EOS Model, the EOS Process, EOS Target Market Clients, Common EOS Client Frustrations, the 5 Leadership Abilities, and an introduction to Jonathan Smith a Certified EOS Implementer.
EOS, the Entrepreneurial Operating System, is a set of timeless business principles and real-world tools that help Entrepreneurs get what they want from their businesses. By mastering this simple “way of operating,” leadership teams of growth-oriented companies systematically and permanently improve. EOS is a proven system with over 10 years of history and is in use in more than 610 companies. It consistently helps companies achieve more revenue growth and more profit, and also delivers a better balance of life to company owners and leaders.
EOS Model – A visual illustration of the Six Key Components.
EOS Process – A visual illustration of the proven process used by an EOS Implementer to help a leadership team master EOS.
Target Market – A clear definition of your organization’s ideal prospects. It defines the demographic profile (who are they?), the geographic profile (where are they?) and the psychographic profile (how do they think?) of those people or organizations most likely to become your best customers.
Hitting the Ceiling – The inevitable phenomenon of getting “stuck” during periods of growth and change. Leaders who master the Five Leadership Abilities become proficient at helping their companies, their departments, and even themselves break through the ceiling.
Five Leadership Abilities – Five essential skills that help leaders break through the inevitable ceilings they hit at three levels – organizationally, departmentally, and personally. The Leadership Abilities are - Simplify, Delegate, Predict, Systemize and Structure.
10 Ways to Growth Hack Your Startup in SingaporeHappy Marketer
It's challenging to scale up your startup if you're on a budget. That's why we've outlined 10 easy ways to growth hack your startup. Here's a cost-effective strategy to grow as a lean startup - that actually works!
Growth Hack Your Way to Startup Traction by @rocketshpRocketshp
Got $4,000 lying around and dying to grow your startup? Look no further, we share lesser-known methods to blast through obstacles and get traction fast. Dive in.
A lecture from the course "Entrepreneurship" at the Goethe University in Frankfurt am Main, Germany. The lecture covers how to get customers for your company, which marketing channels you should choose and how to use behavioral science to get ahead.
Creative Traction Methodology - For Early Stage StartupsTommaso Di Bartolo
How to build a mindset that gets a new product traction? 99% of all startups are forced to give up because they lack traction. As founders are thrilled and captivated to build a product that could change the world - the majority downright neglects to put equal efforts towards how to differentiate in taking the product to market. The difference between those who make it to get traction and the rest lies in the innovator’s mindset.
Managing power in the datacenter can be a good strategy to reduce power and cooling overheard while allowing servers operate at the most efficient power levels and do as much work as possible within your specific power policies.
We found that using Intel Node Manager to set power limits on servers running various workloads increased performance per watt by up to 42.8 percent compared to running the same workloads with no power management solution.
CASE STUDY InternetExcel Exercises, page 434, textRecord your.docxketurahhazelhurst
CASE STUDY
Internet/Excel Exercises, page 434, text
Record your findings in a Word document and submit it online
IBM has substantial operations in many countries, including the United States, Canada, and Germany. Go to finance.yahoo.com/q?s=ibm.
1. Click on Historical Prices. (Or apply this exercise to a different MNC.) Set the date range so that you can obtain quarterly values of the U.S. stock index for the last 20 quarters. Insert the quarterly data on a spreadsheet. Compute the percentage change in IBM’s stock price for each quarter. Next go to finance.yahoo.com/stock-center/ and click (under U.S.) on S&P Composite 1500 Index, which represents the U.S. stock market index, so that you can derive the quarterly percentage change in the U.S. stock index over the last 20 quarters. Then run a regression analysis with IBM’s quarterly return (percentage change in stock price) as the dependent variable and the quarterly percentage change in the U.S. stock market’s value as the independent variable. (Appendix C explains how Excel can be used to run regression analysis.) The slope coefficient serves as an estimate of the sensitivity of IBM’s value to the U.S. market returns. Also, check the fit of the relationship based on the R-squared statistic.
2. Go to finance.yahoo.com/stock-center/ and click (under “Europe”) on DAX, which represents the German stock market index. Repeat the process described in exercise 1 so that you can assess IBM’s sensitivity to the German stock market. Compare the slope coefficient between the two analyses. Is IBM’s value more sensitive to the U.S. market or the German market? Does the U.S. market or the German market explain a higher proportion of the variation in IBM’s returns (check the R-squared statistic)? Offer an explanation of your results.
Lab 5 Database Security
Use the script from week 1 for the week 5 lab.
1. Create four new users
a. The first user will have full rights to the database
b. The second user grant access to the Client’s table and allow them the rights to INSERT data into the clients table
c. The third user grant rights to create user logins and reset passwords
d. The fourth user grant column rights to the Course_Activity table allow access to the Course Code and Grade column. Allow user to UPDATE a maximum of 5 times per hour.
2. Login with each user to demonstrate the rights you have given them
a. User 1 login and create a VIEW for user 2 that just displays the Client table
b. User 2 login and add 3 more clients to the Clients table
c. User 3 login create two new users
d. User 4 login and UPDATE two new entries for Course Code and Grade Column for Client 1 and 2
e. For each user run the Show Privileges command to show correct rights and permissions have been applied
3. Show Log Files: For each user show log files (since we do not have MySQL Enterprise we cannot use the Audit function but as a substitute we can use the built-in log file function)
4. Create a Stored Procedure with User ...
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docxemelyvalg9
Student Lab Activity
A. Lab # CIS CIS170A-A1
B. Lab 5s of 7: Modularization
C. Lab Overview – Scenario / Summary:
TCOs:
TCO: 7
Given a set of program specifications for a simple business problem utilizing a modular design, code and test a program that meets the specifications and employs best programming practices.
TCO: 8
Given a set of program specifications for a simple business problem, code and test a program that implements methods with parameter lists that are passed as supported by the chosen programming language
This lab will familiarize the student with the process of modularizing his or her code.
D. Deliverables:
Step
Deliverable
Points
5
Program Listing, Output, and Project Files
45
The Dropbox deliverables include the following.
1. Include a zipped file with all the files from your Visual Basic project (see directions in Doc Sharing on how to collect and zip files.)
2. Create a single MS Word document and include the following.
· For each lab, copy and paste your code directly into the MS Word file.
· Include screenshot(s) of your test data with test results. Enter enough data to demonstrate that all your code has been tested.
· Include another screenshot of the Visual Basic build output messages. Check your build output to make sure you have a successful build with (0) errors and (0) warnings. NOTE: The build output messages appear at the bottom of your window after you click the Build menu and before you click the Start Without Debugging option. Your build output messages provide a list of compiler warnings or errors and let you know whether your program compiled successfully.
· Include the Word document as part of the zipped project file.
3. Upload each part of the lab into its corresponding weekly Dropbox.
E. Lab Steps:
Preparation:
If you are using the Citrix remote lab, follow the login instructions located in the iLab tab in Course Home.
Locate the Visual Studio 2010 Icon on the desktop. Click to open.
Lab:
Step 1: Create a New Project
Create a new project in VB.NET. Name your project CIS170A_Lab05.
Practically every real-world professional program in existence today uses some type of modular design—this is just the way programs are designed and built. As a result, the primary objective of this lab is for you to understand how modular programs are designed and how data are passed between modules as the program is executing. This may be one of the most important lessons of this course, so it is critical that you focus on the modular design of the program; if you have any questions, post them to the Lab Forum threaded discussion.
In this project, we are going to use the Week 4 Hockey Player Statistics program that you created last week as a starting point and make a few minor changes in the program requirements. What you will do is take the existing project and with only slight modifications to the form design you will modularize the design of the code and then add a few new requirements. As you .
JavaOne2013: Implement a High Level Parallel API - Richard NingChris Bailey
This session discusses how to implement a high-level parallel API (such as parallel_for, parallel_while, or parallel_scan) and math calculation based on a thread pool and task in OpenJDK that aligns with the development of multicores and parallel computing. At present, programmers have to use a schedule strategy statically in code instead of choosing it dynamically based on the core number and load balance on the computer with the current Java concurrent package. In the design presented in the session, the function parallel_for(array, task) is a high-level API that can divide the task range dynamically, based on the condition of and load on different computers.
Presented by Richard Ning at JavaOne 2013
Expert Accessory Dwelling Unit (ADU) Drafting ServicesResDraft
Whether you’re looking to create a guest house, a rental unit, or a private retreat, our experienced team will design a space that complements your existing home and maximizes your investment. We provide personalized, comprehensive expert accessory dwelling unit (ADU)drafting solutions tailored to your needs, ensuring a seamless process from concept to completion.
Book Formatting: Quality Control Checks for DesignersConfidence Ago
This presentation was made to help designers who work in publishing houses or format books for printing ensure quality.
Quality control is vital to every industry. This is why every department in a company need create a method they use in ensuring quality. This, perhaps, will not only improve the quality of products and bring errors to the barest minimum, but take it to a near perfect finish.
It is beyond a moot point that a good book will somewhat be judged by its cover, but the content of the book remains king. No matter how beautiful the cover, if the quality of writing or presentation is off, that will be a reason for readers not to come back to the book or recommend it.
So, this presentation points designers to some important things that may be missed by an editor that they could eventually discover and call the attention of the editor.
Hello everyone! I am thrilled to present my latest portfolio on LinkedIn, marking the culmination of my architectural journey thus far. Over the span of five years, I've been fortunate to acquire a wealth of knowledge under the guidance of esteemed professors and industry mentors. From rigorous academic pursuits to practical engagements, each experience has contributed to my growth and refinement as an architecture student. This portfolio not only showcases my projects but also underscores my attention to detail and to innovative architecture as a profession.
Top 5 Indian Style Modular Kitchen DesignsFinzo Kitchens
Get the perfect modular kitchen in Gurgaon at Finzo! We offer high-quality, custom-designed kitchens at the best prices. Wardrobes and home & office furniture are also available. Free consultation! Best Quality Luxury Modular kitchen in Gurgaon available at best price. All types of Modular Kitchens are available U Shaped Modular kitchens, L Shaped Modular Kitchen, G Shaped Modular Kitchens, Inline Modular Kitchens and Italian Modular Kitchen.
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
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
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
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
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
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
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