Download presentation
Presentation is loading. Please wait.
Published byByron Underwood Modified over 8 years ago
1
Sequential Processing to Update a File Please use speaker notes for additional information!
2
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
3
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
5
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
6
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.
7
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.
8
Sequential Update
9
Sequential Update Logic
10
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
11
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
12
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.
13
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
14
OLD MASTER 121... 123… 222... 234… 333... 345… 444... 456… 512… 999...TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D 999... 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.
15
Sample files OLD MASTER 121... 123… 222... 234… 333... 345… 444... 456… 512… 999...TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D 999... 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.
16
OLD MASTER 121... 123… 222... 234… 333... 345… 444... 456… 512… 999...TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D 999... NEW MASTER 121... 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
17
OLD MASTER 121... 123… 222... 234… 333... 345… 444... 456… 512… 999...TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D 999... NEW MASTER 121… 123... 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
18
OLD MASTER 121... 123… 222... 234… 333... 345… 444... 456… 512… 999...TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D 999... NEW MASTER 121… 123… 124... 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
19
OLD MASTER 121... 123… 222... 234… 333... 345… 444... 456… 512… 999...TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D 999... NEW MASTER 121… 123… 124... 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
20
OLD MASTER 121... 123… 222... 234… 333... 345… 444... 456… 512… 999...TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D 999... NEW MASTER 121… 123… 124... 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
21
OLD MASTER 121... 123… 222... 234… 333... 345… 444... 456… 512… 999...TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D 999... NEW MASTER 121… 123… 124… 222... 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
22
OLD MASTER 121... 123… 222... 234… 333... 345… 444... 456… 512… 999...TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D 999... 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
23
OLD MASTER 121... 123… 222... 234… 333... 345… 444... 456… 512… 999...TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D 999... 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
24
OLD MASTER 121... 123… 222... 234… 333... 345… 444... 456… 512… 999...TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D 999... NEW MASTER 121… 123… 124… 222… 234… 345... 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
25
OLD MASTER 121... 123… 222... 234… 333... 345… 444... 456… 512… 999...TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D 999... NEW MASTER 121… 123… 124… 222… 234… 345... 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
26
OLD MASTER 121... 123… 222... 234… 333... 345… 444... 456… 512… 999...TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D 999... NEW MASTER 121… 123… 124… 222… 234… 345... ERROR REPORT 350… 444... 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
27
OLD MASTER 121... 123… 222... 234… 333... 345… 444... 456… 512… 999...TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D 999... NEW MASTER 121… 123… 124… 222… 234… 345… 444... 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
28
OLD MASTER 121... 123… 222... 234… 333... 345… 444... 456… 512… 999...TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D 999... NEW MASTER 121… 123… 124… 222… 234… 345… 444... ERROR REPORT 350… 444… 450... 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
29
OLD MASTER 121... 123… 222... 234… 333... 345… 444... 456… 512… 999...TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D 999... NEW MASTER 121… 123… 124… 222… 234… 345… 444… 456... ERROR REPORT 350… 444… 450... 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
30
OLD MASTER 121... 123… 222... 234… 333... 345… 444... 456… 512… 999...TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D 999... NEW MASTER 121… 123… 124… 222… 234… 345… 444… 456… 512... ERROR REPORT 350… 444… 450... 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
31
OLD MASTER 121... 123… 222... 234… 333... 345… 444... 456… 512… 999...TRANSACTIONS 121…C 124…A 222…C 333…D 350… C 444… A 450… D 999... NEW MASTER 121… 123… 124… 222… 234… 345… 444… 456… 512... ERROR REPORT 350… 444… 450... 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
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.