Sequential Processing to Update a File Please use speaker notes for additional information!

Slides:



Advertisements
Similar presentations
Testing Relational Database
Advertisements

Using H.E.L.P. on a Network Report Solutions Inc. 435 West Broadway Centralia, IL
DT266/2 Information Systems COBOL Revision. Chapters 1 & 2 Hutty & Spence Divisions of a Cobol Program Identification Division Program-ID. Environment.
Lectures on File Management
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Processing with VSAM Files Please use speaker notes for additional information!
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming The software development method algorithms.
Chapter 8 - Visual Basic Schneider1 Chapter 8 Sequential Files.
Chapter 8 USING ACCOUNTING APPLICATIONS. Organization of Accounting Applications.
What's New in the CVS-EEP Entry Tool This document points out some the new features and improvements we've made in recent versions. version by Michael.
General Algorithms for Common Business Problems
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
TRANSACTION PROCESSING SYSTEM Liew Woei Song Muhammad Hofiz Achoson.
What Are File Maintenance Techniques and Validation Techniques?
CHAPTER 6 ELECTRONIC DATA PROCESSING SYSTEMS
Chapter Seven Advanced Shell Programming. 2 Lesson A Developing a Fully Featured Program.
CC0002NI – Computer Programming Computer Programming Er. Saroj Sharan Regmi Week 7.
Structured COBOL Programming, Stern & Stern, 9th edition
Scheduling Instructions- Elementary Working in the Mainframe to schedule students for the Esembler Grade Book Program If you wish to view a printable version.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. ACCESS 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 4 – Creating New.
CS&E 1111 AcInnerJoins Inner Joins Objectives: Creating Queries with data from Multiple Tables Joining two tables using an Inner Join Referential Data.
Chapter 13 Sequential File Processing. Master Files Set of files used to store companies data in areas like payroll, inventory Usually processed by batch.
The Fun That Is File Structures Pages By: Christine Zeitschel.
Data and its manifestations. Storage and Retrieval techniques.
Programming Examples to Accompany Structure Topic Please use speaker notes for additional information!
 Once the system has been installed it will be monitored to check whether it is working correctly. Sometimes problems with a system will not be found.
Logic Structure - focus on looping Please use speaker notes for additional information!
System Development Lifecycle Verification and Validation.
Array - adding to array at run time Please see speaker notes for additional information!
Practice and Evaluation. Practice Develop a java class called: SumCalculator.java which computes a sum of all integer from 1 to 100 and displays the result.
Indexed and Relative File Processing
Edit Programs Please use speaker notes for additional information. Example: payedit.cbl payedit.cbl.
Systems Life Cycle. Know the elements of the system that are created Understand the need for thorough testing Be able to describe the different tests.
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.
Now, please open your book to page 60, and let’s talk about chapter 9: How Data is Stored.
An Introduction to Programming with C++ Sixth Edition Chapter 7 The Repetition Structure.
General Algorithms for Common Business Problems Simple Program Design Third Edition A Step-by-Step Approach 10.
Enhancing Forms with OLE Fields, Hyperlinks, and Subforms – Project 5.
Introduction to Database using Microsoft Access 2013 Part 7 November 19, 2014.
Basic & Advanced Reporting in TIMSNT ** Part Three **
13-1 Sequential File Processing Chapter Chapter Contents Overview of Sequential File Processing Sequential File Updating - Creating a New Master.
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.
© The McGraw-Hill Companies, 2006 Chapter 3 Iteration.
Analysis of SAMPLE1.CBL Please check speaker notes for additional information!
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.
Random update Please use speaker notes for additional information!
Two file sequential file processing (maximum 1 record per id on each file) Please use speaker notes for additional information!
Array Applications. Objectives Design an algorithm to load values into a table. Design an algorithm that searches a table using a sequential search. Design.
Sequential Update Assignment Notes Please use speaker notes for additional information!
( ) 1 Chapter # 8 How Data is stored DATABASE.
Visual Basic - Break Processing
Processing multiple files
File and Database Processing
Week 12 Option 3: Database Design
Chapter 9 Database and Information Management.
Please use speaker notes for additional information!
Programming Logic and Design Fourth Edition, Comprehensive
An Introduction to Structured Program Design in COBOL
Minor, Intermediate and Major Breaks
Searching an Array or Table
Please use speaker notes for additional information!
Please use speaker notes for additional information!
Using screens and adding two numbers - addda.cbl
CHAPTER 6 ELECTRONIC DATA PROCESSING SYSTEMS
2 file sequential matching with multiple records allowed on file 2
Presentation transcript:

Sequential Processing to Update a File Please use speaker notes for additional information!

Sequential Updating EDIT: The transactions that will be used in the update must be as error free as possible to prevent corrupting the master file. To assure the integrity of the data, the transactions should be processed in an edit program and only valid transactions should be allowed to update the master file. The output of the edit file includes the valid (good) transaction file which will be processed in the next step. SORT: The master file is in some kind of order - the usual order is by identification number. The transaction file must be in the same order as the master file. The sort program sorts the valid transactions and creates a sorted valid transaction file. UPDATE: The update program uses the sorted valid transaction file to update the master file, creating a new master file and reports. In a maintenance update there can be add, change or delete transactions so records can be added to the new master, changed on the new master, or deleted so they do not appear on the new master. The update program completes the updating maintenance cycle. Update

Steps to update Data Edit Program Sorted Valid Trans Sort Valid Trans Errors can be put on disk, printed, interactively corrected or any combination of solutions. Master File Update Program New Master File Errors Note: Errors can be written to disk, printed, interactively corrected or any combination of solutions. An optional paper trail can also be produced on disk, paper or another medium. Trail

Data Edit Program Valid Trans EDIT Program This processing where the data is entered and errors are produced is frequently done by data entry operators who enter the data quickly and accurately. The errors will be reprocessed and reentered at a later date. Trans with Errors Edit Program Valid Trans Data Trans with Errors This processing can be done interactively. In that case, the data entry person is frequently someone who is knowledgeable about the data and can fix the errors that are shown on the screen. Only errors that cannot be fixed are put to either disk/report or both. and /or

Sort Program Sorted Valid Trans Sort Valid Trans When you are going to do a Sequential Update, the transactions must be sorted so they are in the same order as the records on the file that you are going to update. Since you are going to process each file sequentially, one record at a time, it is critical that they be in the same order.

Sorted Valid Trans Master File Update Program New Master File ErrorsTrail Sequential Update Program SEQUENTIAL UPDATE: Information that is kept on files needs to be modified as changes to the information on the file occur. This process is called UPDATING and the files that are being updated are usually called MASTER FILES. Updating allows the company to keep a file up-to-date. Without an update, the file would be obsolete shortly after it was created. Updating a file can involve the following: Adding records to the file Changing records on the file Deleting records from the file Add, change, and delete transactions that will be used to update the master file are either keyed in and saved on a transaction file or keyed in from a screen. Frequently the screen input is also saved on a file to provide a trail of transactions. That transaction file will be processed with the master file to update the file.

Sequential Update

Sequential Update Logic

Flowchart Mainline Initialize Process Wrapup Stop Run Initialize Process End Process End Initialize Open files Read old master Read transactions MID & TID not EOF(9s) LOOP Y N Wrapup End Wrapup Close files

Logic flowchart continued Loop MID < TID Write routine Read old master Y N MID =TID Change Routine Read transaction Y Y Y N N Delete Routine Read transaction Add Error Read transaction Read old master YN Add Routine (includes write) Read transaction Change Error Read transaction Delete Error Read transaction Y N N

Logic flowchart continued Write Routine Write new master from master work End Write Routine Change Routine Record old to report (optional) Field1 not spaces Last field1 = “-” Space out field1 in master work N Y YN Trans data to field1 in master work NOTE: Repeat the check illustrated above for all fields that could be changed. Record changes to report (trail). End Change Routine Delete Routine Record deleted written on report. End Delete Routine Add Routine End Add Routine Record added written on report. Write new master from add trans Note that I am writing to the report for a paper trail.

Logic flowchart continued Add Error Routine Record add error written on report. End Add Error Routine Change Error Routine Record change error written on report. End Change Error Routine Delete Error Routine Record delete error written on report. End Delete Error Routine Wrapup Routine Close all files End Wrapup Routine Read Old Master Routine End Read Old Master Routine Read old master MOVE all 9s to MID Read Trans Routine End Read Trans Routine Read transaction MOVE all 9s to TID

OLD MASTER … … … … 512… TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D We are going to assume that these are the files we are reading. The … stands for the data on the file. In looking at the logic for processing we are going to focus on comparing the id numbers on the two files and the transaction code which tells us whether the transaction is designed to add a record, change a record or delete a record. The output that is produced will be a new master file with the valid additions, changes and deletions made and an error report with a trail of the invalid add, changes and deletes.

Sample files OLD MASTER … … … … 512… TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D NEW MASTER ERROR REPORT The first record from each file is read. MID =121, TID = 121. Therefore MID = TID. Since the transaction code is a C, the change is made in the work area. Since the transaction has now been handled, a new transaction will be read.

OLD MASTER … … … … 512… TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D NEW MASTER ERROR REPORT MID = 121 and TID =124 therefore MID < TID. When this happens we write the old record (in this case complete with the changes that were made based on the previous transaction) to the new master. A record will now be read from the old master file. Logic continued

OLD MASTER … … … … 512… TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D NEW MASTER 121… ERROR REPORT MID = 123 and TID =124 therefore MID < TID. When this happens we write the old record (in this case it is a record that has no changes) to the new master. A record will now be read from the old master file. Logic continued

OLD MASTER … … … … 512… TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D NEW MASTER 121… 123… ERROR REPORT MID = 222 and TID =124 therefore MID > TID. Now we need to check the transaction code. It is an A. This is the situation where it is valid to ADD a record so the information from record with TID=124 will be written to the new master. Since this transaction has now been processed, a new transaction will be read. Logic continued

OLD MASTER … … … … 512… TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D NEW MASTER 121… 123… ERROR REPORT MID = 222 and TID =222 therefore MID = TID. When we check the transaction code we find that it is a C and matching identification numbers is what we need to make a change. The change will get made in the work area. Since this transaction has now been processed, a new transaction will be read. Logic continued

OLD MASTER … … … … 512… TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D NEW MASTER 121… 123… ERROR REPORT MID = 222 and TID =222 therefore MID = TID. When we check the transaction code we find that it is a C and matching identification numbers is what we need to make a change. The change will get made in the work area. Since this transaction has now been processed, a new transaction will be read. Logic continued

OLD MASTER … … … … 512… TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D NEW MASTER 121… 123… 124… ERROR REPORT MID = 222 and TID =333 therefore MID < TID. This means we should write the old master record - complete with changes from the two transactions - on to the new master file. Since we have not processed the new transaction but we are done with the master, we will now read another master record. Logic continued

OLD MASTER … … … … 512… TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D NEW MASTER 121… 123… 124… 222… 234… ERROR REPORT MID = 234 and TID =333 therefore MID < TID. This means we should write the old master record on to the new master file. Since we have not processed the new transaction but we are done with the master, we will now read another master record. Logic continued

OLD MASTER … … … … 512… TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D NEW MASTER 121… 123… 124… 222… 234… ERROR REPORT MID = 333 and TID =333 therefore MID = TID. This means that a delete is valid Since a delete involves dealing with the master and the transaction, we read a new record from each table. Logic continued

OLD MASTER … … … … 512… TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D NEW MASTER 121… 123… 124… 222… 234… ERROR REPORT MID = 345 and TID =350 therefore MID < TID. This means that 345 will be written to the new master. Since the master has been dealt with, a new master is read. Logic continued

OLD MASTER … … … … 512… TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D NEW MASTER 121… 123… 124… 222… 234… ERROR REPORT 350… MID = 444 and TID =350 therefore MID > TID. We need to check the transaction code. Since it is a C the fact that they are not equal means that this is an invalid change. The change error is written the error report. Since the transaction has been handled (as an error), another transaction is read. Logic continued

OLD MASTER … … … … 512… TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D NEW MASTER 121… 123… 124… 222… 234… ERROR REPORT 350… MID = 444 and TID =444 therefore MID = TID. We need to check the transaction code. Since it is a A, the fact that they are equal means that this is an invalid change. The add error is written on the error report. Since the transaction has been handled (as an error), another transaction is read. Logic continued

OLD MASTER … … … … 512… TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D NEW MASTER 121… 123… 124… 222… 234… 345… ERROR REPORT 350… 444… MID = 444 and TID =450 therefore MID < TID. Since the master is the smallest it will be processed. That means that 444 is copied to the new master. Since the master has been dealt with, a new master will be read. Logic continued

OLD MASTER … … … … 512… TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D NEW MASTER 121… 123… 124… 222… 234… 345… ERROR REPORT 350… 444… MID = 456 and TID =450 therefore MID >TID. In this condition, a Delete is invalid. Therefore 450 is written to the error report. A new transaction record will be read. Logic continued

OLD MASTER … … … … 512… TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D NEW MASTER 121… 123… 124… 222… 234… 345… 444… ERROR REPORT 350… 444… MID = 456 and TID =999 therefore MID < TID. Since the master is less it will be copied to the new master. Another master record will be read. Logic continued

OLD MASTER … … … … 512… TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D NEW MASTER 121… 123… 124… 222… 234… 345… 444… 456… ERROR REPORT 350… 444… MID = 512 and TID =999 therefore MID < TID. Since the master is less it will be copied to the new master. Another master record will be read. Logic continued

OLD MASTER … … … … 512… TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D NEW MASTER 121… 123… 124… 222… 234… 345… 444… 456… ERROR REPORT 350… 444… MID = 999 and TID =999 therefore MID = TID and more importantly they both = 999. This means that end of file has been reached on both files and processing will terminate. Logic continued