General Algorithms for Common Business Problems

Slides:



Advertisements
Similar presentations
Chapter 2: Modularization
Advertisements

Chapter 9: Advanced Array Manipulation
Repetition Control Structures
Programming Logic and Design Fourth Edition, Introductory
Programming Logic and Design Fourth Edition, Introductory
Programming Logic and Design, Second Edition, Comprehensive
Chapter 7: Control Breaks Programming Logic and Design, Third Edition Comprehensive.
Programming Logic and Design, Third Edition Comprehensive
Programming Logic and Design Fourth Edition, Introductory
Writing a Complete Program
Chapter 8 USING ACCOUNTING APPLICATIONS. Organization of Accounting Applications.
Modules, Hierarchy Charts, and Documentation
Understanding the Mainline Logical Flow Through a Program (continued)
Pseudocode.
Chapter 1 Program Design
Metode Perancangan Program
Pseudocode.
Structured COBOL Programming, Stern & Stern, 9th Edition PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured.
Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout.
Chapter 07 Control Breaks.
10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control.
Programming Logic and Design Seventh Edition
10-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
Simple Program Design Third Edition A Step-by-Step Approach
Array Processing Simple Program Design Third Edition A Step-by-Step Approach 7.
Program Design Simple Program Design Third Edition A Step-by-Step Approach 9.
First Steps in Modularization Simple Program Design Third Edition A Step-by-Step Approach 8.
Chapter 3 Developing an algorithm. Objectives To introduce methods of analysing a problem and developing a solution To develop simple algorithms using.
Selection Control Structures Simple Program Design Third Edition A Step-by-Step Approach 4.
Array Processing.
Printing on power systems Program/ Command Data Report Layout (Printer File) Job Output Queue *FILE Spooled File.
Selection Control Structures. Simple Program Design, Fourth Edition Chapter 4 2 Objectives In this chapter you will be able to: Elaborate on the uses.
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 5 Arrays.
File Handling and Control Break Logic. Objectives In this chapter, you will learn about: Computer files Writing a program that reads from and/or writes.
Indexed and Relative File Processing
6 Chapter 61 Looping Programming Logic and Design, Second Edition, Comprehensive 6.
13-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
Sequential Files Chapter 13. Master Files Set of files used to store companies data in areas like payroll, inventory Set of files used to store companies.
Any Questions? Control Breaks Agenda Control Breaks –Also known as Reports with sub-totals.
An Introduction to Programming with C++ Sixth Edition Chapter 7 The Repetition Structure.
Pseudocode. Simple Program Design, Fourth Edition Chapter 2 2 Objectives In this chapter you will be able to: Introduce common words, keywords, and meaningful.
Pseudocode Simple Program Design Third Edition A Step-by-Step Approach 2.
General Algorithms for Common Business Problems Simple Program Design Third Edition A Step-by-Step Approach 10.
Cs413_design04.ppt Design and Software Development Design : to create a functional interface that has high usability Development : an organized approach.
Pseudocode Algorithms Using Sequence, Selection, and Repetition
Pseudocode Algorithms Using Sequence, Selection, and Repetition Simple Program Design Third Edition A Step-by-Step Approach 6.
First Steps in Modularization. Simple Program Design, Fourth Edition Chapter 8 2 Objectives In this chapter you will be able to: Introduce modularization.
Developing an Algorithm. Simple Program Design, Fourth Edition Chapter 3 2 Objectives In this chapter you will be able to: Introduce methods of analyzing.
First Steps in Modularization. Simple Program Design, Fourth Edition Chapter 8 2 Objectives In this chapter you will be able to: Introduce modularization.
13-1 Sequential File Processing Chapter Chapter Contents Overview of Sequential File Processing Sequential File Updating - Creating a New Master.
1.  Introduction  The Benefits of the Report Writer Module ◦ For Detail and Summary Printing ◦ For Control Break Processing ◦ For Printing Headings.
13- 1 Chapter 13.  Overview of Sequential File Processing  Sequential File Updating - Creating a New Master File  Validity Checking in Update Procedures.
Master File Update Processing. Objectives On completing this section you should be able to: w Distinguish between online processing and batch processing.
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
1 Objectives ❏ To understand the differences between text and binary files ❏ To write programs that read, write, and/or append binary files ❏ To be able.
Control Break Processing
COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
Chapter 11: Sequential File Merging, Matching, and Updating Programming Logic and Design, Third Edition Comprehensive.
11 Chapter 111 Sequential File Merging, Matching, and Updating Programming Logic and Design, Second Edition, Comprehensive 11.
Chapter 9 General algorithms for common business problems.
Sequential Processing to Update a File Please use speaker notes for additional information!
Chapter 7 CASE Control Structure © 2008 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. Marilyn Bohl/Maria Rynn Tools for Structured.
Further Modularization, Cohesion, and Coupling. Simple Program Design, Fourth Edition Chapter 9 2 Objectives In this chapter you will be able to: Further.
Please use speaker notes for additional information!
Programming Logic and Design Fourth Edition, Comprehensive
An Introduction to Structured Program Design in COBOL
Designing and Writing Control-Break Programs
CHAPTER 17 The Report Writer Module
Writing a Complete Program
2 file sequential matching with multiple records allowed on file 2
Presentation transcript:

General Algorithms for Common Business Problems

Simple Program Design, Fourth Edition Chapter 10 Objectives In this chapter you will be able to: Provide general pseudocode algorithms to four common business applications. Topics covered are: Report generation with page break Single-level control break Multiple-level control break Sequential file update Simple Program Design, Fourth Edition Chapter 10

Simple Program Design, Fourth Edition Chapter 10 Program Structure The aim of this chapter is to present a number of general pseudocode solutions for typical programming problems This basic solution algorithm forms the framework for most commercial business programs It does not include processing for page headings, control breaks, total lines, or special calculations Examine the hierarchy chart and pseudocode shown on pages 161 and 162 of the textbook Simple Program Design, Fourth Edition Chapter 10

Report Generation with Page Break Most reports require page heading lines, column heading lines, detail lines, and total lines Reports are also required to skip to a new page after a predetermined number of detail lines have been printed Examine the typical report on page 162 of the textbook along with the hierarchy chart and pseudocode of the solution algorithm on pages 162 through 164 of the textbook Simple Program Design, Fourth Edition Chapter 10

Single-Level Control Break A control break total line is a summary line for a group of records that contain the same record key There are two things you must consider when designing a control break program: The file to be processed must have been sorted into control field sequence Each time a record is read from the input file, the control field on the current record must be compared with the control field on the previous record Simple Program Design, Fourth Edition Chapter 10

Single-Level Control Break A Hierarchy Chart (shown on page 165) All control break report programs will require the following variables: A variable named this_control_field which will hold the control field of the record just read A variable named prev_control_field which will hold the control field of the previous record One or more variables to accumulate the control break totals One or more variables to accumulate the report totals Simple Program Design, Fourth Edition Chapter 10

Single-Level Control Break B Solution Algorithm (shown on page 166 and 167) There are four points in this mainline algorithm that are essential for a control break program to function correctly: Each time a new record is read from the file, the new control field is assigned to the variable this_control_field When the first record is read, the new control field is assigned to both the variables this_control_field and prev_control_field The variable prev_control_field is updated as soon as a change in the control field is detected After the end of the file has been detected, the module Print_control_total_line will print the control break totals for the last record or set of records Simple Program Design, Fourth Edition Chapter 10

Multiple-Level Control Break Often reports are required to produce multiple-level control break totals The concepts that applied to a single-level control break program also apply to a multiple-level control break program The general solution algorithm that was developed for a single-level control break program can be extended by the addition of two new modules to incorporate a two-level control break A Hierarchy Chart (shown on page 169) Simple Program Design, Fourth Edition Chapter 10

Multiple-Level Control Break B Solution Algorithm (shown on pages 170 through 172) The points to be noted in this mainline are: Each time a new record is read from the input file, the new control fields are assigned to the variables this_minor_control_field and this_major_control_field When the first record is read, the new control fields are assigned to both the current and previous control field variables After the end of the input file has been detected, the two modules Print_minor_control_totals and Print_major_control_totals will print control totals for the last minor control field record, or set of records, and the last major control field or set of records Simple Program Design, Fourth Edition Chapter 10

Sequential File Update Sequential file updating involves updating a master file by applying update transactions on a transaction file Both files are sequential A new master file that incorporates the update transaction is produced A system flowchart of a sequential update program is illustrated on page 173 of the textbook Simple Program Design, Fourth Edition Chapter 10

Simple Program Design, Fourth Edition Chapter 10 System Concepts Master File A master file is a file that contains permanent and semi-permanent information about the data entities it contains Transaction File A transaction file contains all the data and activities that are included on the master file If the transaction file has been designed specifically to update a master file, there are usually three types of update transactions on this file Simple Program Design, Fourth Edition Chapter 10

Simple Program Design, Fourth Edition Chapter 10 System Concepts These are transactions to: Add a new record Update or change an existing record Delete an existing record Audit Report An audit report is a detailed list of all the transactions that were applied to the master file Error Report An error report is a detailed list of errors that occurred during the processing of the update Simple Program Design, Fourth Edition Chapter 10

Sequential Update Logic Processing involves reading a record from each of the input files and comparing the keys of the two records As a result of this comparison, processing falls generally into three categories: If the key on the transaction record is less than the key on the old master record, the transaction is probably an add transaction If the key on the transaction record is equal to the key on the old master record, the transaction is probably an update or delete transaction If the key on the transaction record is greater than the key on the old master record, there is no matching transaction for that master record Simple Program Design, Fourth Edition Chapter 10

Sequential Update Logic Sequential update programs also need to include logic that will handle multiple transaction records for the same master record, and the possibility of transaction records that are in error The types of transaction record errors that can occur are: An attempt to add a new master record when a record with that key already exists on the master file An attempt to update a master record when there is no record with that key on the master file An attempt to delete a master record when there is no record with that key on the master file An attempt to delete a master record when the current balance is not equal to zero Simple Program Design, Fourth Edition Chapter 10

Balance Line Algorithm A good general solution algorithm written in pseudocode was presented by Barry Dwyer in a paper entitled ‘One More Time – How to Update a Master File’1 This algorithm has been referred to as the balance line algorithm It handles multiple transaction records for the one master record, as well as the possibility of transaction record errors 1 Barry Dwyer, ‘One More Time- How to Update a Master File’, Comm. ACM, Vol. 124, No. 1, January 1981. Simple Program Design, Fourth Edition Chapter 10

Balance Line Algorithm A modularized version of the balance line algorithm is presented in this chapter A Hierarchy Chart (shown on page 176) B Solution Algorithm Refer to the mainline and subordinate modules shown on pages 176 through 179 of the textbook Simple Program Design, Fourth Edition Chapter 10

Simple Program Design, Fourth Edition Chapter 10 Summary The aim of this chapter was to develop general pseudocode algorithms to four common business applications The applications covered were: Report generation with page break Single-level control break Multiple-level control break Sequential file update Simple Program Design, Fourth Edition Chapter 10