230 likes | 332 Views
Chapter 13. Sequential File Processing. Master Files. Set of files used to store companies data in areas like payroll, inventory Usually processed by batch processing Typically stored on magnetic disk Disks can store billions of characters Disk drives read, write data quickly
E N D
Chapter 13 Sequential File Processing
Master Files • Set of files used to store companies data in areas like payroll, inventory • Usually processed by batch processing • Typically stored on magnetic disk • Disks can store billions of characters • Disk drives read, write data quickly • Disk records can be any size
Sequential Files • Records always read in sequence • Read first record, process it, then read second record, process it and so on • Payroll records in order by employee number may be processed in sequence for updating or printing reports
Sequential Files • May be sorted into any sequence using any field in record • To distribute checks more easily, records may be sorted by department • Sequential processing then used to print checks, reading first record, then second, etc.
Master File Procedures Typical procedures for sequential processing in batch mode are: • Designing Master File • Creating Master File • Creating Transaction File • Updating Master File • Reporting from Master File
Designing a Master File • Place key fields that uniquely identify record at beginning of record • If possible, choose numeric key fields • Secondary fields after primary key fields • Remaining fields appear in order of importance • Group common fields together (i.e., address)
Designing a Master File • Choose field size large enough to accommodate data stored in it • Use coded fields where possible to save space • Be sure all date fields include four-digit year
Creating a Master File • Original master file data entered interactively, stored on disk file • Ensure data integrity by using data validation techniques to minimize risk or errors • Control listing or audit trail produced to show data stored in new master file and control totals
Creating a Transaction File • Changes to master file made with separate procedure • Change records stored in file called transaction file
Updating a Master File • Updating is process of making master file current • Update master file by incorporating changes from transaction records
Reporting from a Master File • Scheduled reports prepared on regular basis from data stored in master file • Sales reports, customer bills, checks, etc. • Use detail, exception and group printing techniques • On demand reports produced as need arises • May be in report form or displayed on screen
Creating Master, Transaction Files • Data may be read in from another file or entered interactively from keyboard • If data entered is valid, move it to master or transaction record fields • WRITE new record to file
Sequential File Updating Two input files • Input Master File (Old-Master) • Current through previous updating period • Does not contain changes since previous update • Input Transaction File (Trans-File) • Contains changes since previous update to be applied to Old-Master
Sequential File Updating Two output files • Output Master File (New-Master) • Integrates data from Old-Master with all of changes from Trans-File • Will become Old-Master for next update • Control Listing or Audit Trail • Print file showing changes made to master file, errors during processing and control totals
Ordering of Records • Records in Old-Master and Trans-File must be in order by same key field • Compare key fields to determine if given master record is to be updated
Master/Transaction Processing • Records in both files must be sorted (sequenced) on the same key • Records from each file are “matched”