13-1 Sequential File Processing Chapter 13. 13-2 Chapter Contents Overview of Sequential File Processing Sequential File Updating - Creating a New Master.

Slides:



Advertisements
Similar presentations
1 of : Multi-Currency Payments / DA0813 Last updated: Project Walkthrough: Multi-Currency Payments Multi-Currency Payments.
Advertisements

1 of 39 DA1245 Enhanced Transaction Tracking Last updated: March-2009 DA1245 Enhanced Transaction Tracking.
Overview of Transaction Processing and Enterprise Resource Planning Systems Chapter 2.
Chapter 15 Indexed Sequential Files. Disk File Organization File is collection of records Three major ways records stored or organized on disk - Sequential.
Databases and Processing Modes. Fundamental Data Storage Concepts and Definitions What is an entity? An entity is something about which information is.
Chapter 8 USING ACCOUNTING APPLICATIONS. Organization of Accounting Applications.
General Algorithms for Common Business Problems
Chapter 6 AN INTRODUCTION TO FILES AND FILE PROCESSING Dr. Ali Can Takinacı İstanbul Technical University Faculty of Naval Architecture and Ocean Engineering.
Overview of Transaction Processing and Enterprise Resource Planning Systems Chapter 2.
Chapter Lead Black Slide © 2001 Business & Information Systems 2/e.
McGraw-Hill/Irwin Introduction to QuickBooks Pro, 2004 © 2005 The McGraw-Hill Companies, Inc., All Rights Reserved. Chapter 4 Bank Reconciliation.
TRANSACTION PROCESSING SYSTEM Liew Woei Song Muhammad Hofiz Achoson.
CHAPTER 6 ELECTRONIC DATA PROCESSING SYSTEMS
VSAM KSDS and COBOL Department of Computer Science Northern Illinois University August 2005 Some of the illustrations are from VSAM: Access Method Services.
15-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)
File Management Chapter 12. File Management File management system is considered part of the operating system Input to applications is by means of a file.
Lead Black Slide Powered by DeSiaMore1. 2 Chapter 10 Business Operations.
4-1 Coding Complete COBOL Programs: The PROCEDURE DIVISION Chapter 4.
4-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)
NextGen Trustee Department Disbursements This class will cover the various methods of handling department disbursements. Whether entering them manually.
10- 1 Chapter 10. To familiarize you with  Main types of computer-generated reports  Techniques used for efficient printing of group reports and control.
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)
4-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)
1 Chapter 4. To familiarize you with methods used to 1. Access input and output files 2. Read data from an input file 3. Perform simple move operations.
Chapter 13 Sequential File Processing. Master Files Set of files used to store companies data in areas like payroll, inventory Usually processed by batch.
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
Access Online Cardholder Transaction Approval Training 1 Client Logo.
3-1 Chapter 3. To familiarize you with  Ways in which data is organized in COBOL  Rules for forming data-names  Defining input and output files in.
Printing on power systems Program/ Command Data Report Layout (Printer File) Job Output Queue *FILE Spooled File.
1 California State University, Fullerton Chapter 10 Business Operations.
Chapter 7 File I/O 1. File, Record & Field 2 The file is just a chunk of disk space set aside for data and given a name. The computer has no idea what.
Indexed and Relative File Processing
Edit Programs Please use speaker notes for additional information. Example: payedit.cbl payedit.cbl.
 2001 Prentice Hall Business Publishing, Accounting Information Systems, 8/E, Bodnar/Hopwood Chapter 10 Electronic Data Processing Systems.
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.
General Algorithms for Common Business Problems Simple Program Design Third Edition A Step-by-Step Approach 10.
SUPPLEMENTAL B An Overview of The General Ledger Architecture.
Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout.
Chapter 9 Controlling Information Systems: Application Controls.
11- 1 Chapter 11.  Avoiding Logic Errors by Validating Input  What to Do If Input Errors Occur  Global Considerations in COBOL  When Data Should Be.
An Overview of The General Ledger Architecture.  Files are used to store data and processing instruction. The two types of files computer users use most.
 2013 Pearson Education, Inc. Publishing as Prentice Hall, AIS, 11/e, by Bodnar/Hopwood Chapter 7 7 – 1 Electronic Data Processing Systems.
Types of Processing of Data www. ICT-Teacher.com.
Chapter 11 Data Validation. Question Should your program assume the data is correct, or should your program edit the data to ensure it is correct?
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.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 9 Designing Databases 9.1.
Control Break Processing
11- 1 Chapter 11.  Avoiding Logic Errors by Validating Input  What to Do If Input Errors Occur  Global Considerations in COBOL  When Data Should Be.
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!
Sequential Processing to Update a File Please use speaker notes for additional information!
Topics Covered: File Components of file Components of file Terms used Terms used Types of business file Types of business file Operations on file Operations.
Company File Setup and Maintenance Chapter 6. PAGE REF #CHAPTER 6: Company File Setup and Maintenance SLIDE # 2 2 Objectives Use the EasyStep Interview.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
( ) 1 Chapter # 8 How Data is stored DATABASE.
(1) Organize information processing centers environment, the various functions and details Electronic Data Processing (EDP): can refer to the use of automated.
Electronic Data Processing Systems Chapter 6.
Designing and Debugging Batch and Interactive COBOL Programs
Chapter 3 The DATA DIVISION.
Please use speaker notes for additional information!
Programming Logic and Design Fourth Edition, Comprehensive
An Introduction to Structured Program Design in COBOL
Chapter 14 Sorting and Merging.
Please use speaker notes for additional information!
CHAPTER 6 ELECTRONIC DATA PROCESSING SYSTEMS
Presentation transcript:

13-1 Sequential File Processing Chapter 13

13-2 Chapter Contents Overview of Sequential File Processing Sequential File Updating - Creating a New Master File Validity Checking in Update Procedures Update Procedures with Multiple Transaction Records

13-3 Chapter Contents Balanced Line Algorithm for Sequential File Updating Sequential File Updating - Rewriting Records on Disk Matching Files for Checking Purposes Interactive Updating of Sequential File

13-4 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

13-5 Sequential Files Records always read in sequence Read first record, process it, then read second record, process it and so on –For example payroll records in order by employee number may be processed in sequence for updating or printing reports –Example used in book

13-6 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.

13-7 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

13-8 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

13-9 Designing a Master File Choose field size large enough to accommodate data that may be stored in it Use coded fields where possible to save space (not a big problem anymore) Be sure all date fields include four-digit year

13-10 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

13-11 Creating a Transaction File Changes to master file made with separate procedure Changed records stored in file called transaction file

13-12 Updating a Master File Create a new blank file (New Master) Updating is process of making master file current Update master file by incorporating changes from transaction records

13-13 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

13-14 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

13-15 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

13-16 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

13-17 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

13-18 Sequential Update Example For accounts receivable file, account number may be selected as key field Records in both input files in sequence by account number –Old-Master key field is M-Acct-No –Trans-file key field is T-Acct-No New-Master file also created in account number sequence (Acct-No-Out)

13-19 Sequential Update Procedure One transaction record for each master record to be updated (p. 570) –Contains total amount to be added to amount field in corresponding master record Initially, record read from both Old- Master and Trans-File Comparison of M-Acct-No and T-Acct- No determines next step

) T-Acct-No = M-Acct-No Means transaction record exists with same account number as master record Perform regular update, adding Trans- File amount to Old-Master amount, storing result in New-Master field Write record to New-Master file Read next record from both Old-Master and Trans-File

) T-Acct-No > M-Acct-No Means master record exists for which there is no corresponding transaction record Write record from Old-Master to New- Master as is, since no changes need to be made to it Read next record from Old-Master Basically do nothing but copy

) T-Acct-No < M-Acct-No Means transaction record exists for which there is no corresponding master record Two ways to process this transaction –Create record in New-Master file for this transaction –May assume that T-Acct-No is invalid since no match found in Old-Master file and treat as error condition

13-23 Use of HIGH-VALUES COBOL reserved word HIGH-VALUES Move it into a variable (p. 573) Refers to largest value in computer's collating sequence Used so all records from both Old- Master and Trans-File are processed May reach end of Old-Master file before reaching end of Trans-File or vice versa

13-24 Use of HIGH-VALUES When last record read from Old-Master, M-Acct-No set to HIGH-VALUES –For all remaining transaction records T-Acct-No < M-Acct-No –Processed as new accounts and added to New-Master –This allows the transaction file to keep going when you are out of files from the old master file

13-25 Use of HIGH-VALUES When last record read from Trans-File, T-Acct-No set to HIGH-VALUES –For all remaining Old-Master records T-Acct-No > M-Acct-No –Old-Master records added to New-Master without changes –Old keeps going

13-26 Use of HIGH-VALUES Loop to process records ends only when both account numbers equal HIGH-VALUES May be used only with fields defined as alphanumeric –Define account number fields with PIC of Xs even though fields contain numbers

13-27 Validity Checking in Updating Code field may be added to each transaction record to indicate whether transaction is –New account to be added –Update to existing account –Deletion of existing account Comparison of keys and transaction code type enable program to detect other update errors

13-28 Multiple Transaction Records To process more than one change for each master record requires different update procedure In accounts receivable file example, transaction record may be created for each purchase or credit by customer Amounts in all transaction records for one customer need to be added to amount in Old-Master file record

13-29 Multiple Transaction Records Add loop to regular update routine to read and process multiple transaction records for same Old-Master record –Continue to read records from Trans-File until T-Acct-No Not = M-Acct-No

13-30 Balanced Line Algorithm Technique to update master file –With any number of transactions –With checks for error conditions Viewed as most efficient and effective sequential file updating method Two new fields used to control updating –WS-Control-Key –WS-Allocated-Switch

13-31 WS-Control-Key Determines type of processing Called control or active key field Set to smaller of M-Acct-No or T-Acct-No Then comparison of M-Acct-No or T-Acct-No to WS-Control-Key used to control further processing Kind of like the control break processing

13-32 WS-Allocated-Switch Used for error control –To ensure records processed correctly –To detect erroneous codes in transactions Set to 'YES' when record should be written to New-Master file Set to 'NO' if record should not be written to New-Master file

) M-Acct-No < T-Acct-No WS-Control-Key set to M-Acct-No WS-Allocated-Switch set to 'YES' because WS-Control-Key and M-Acct- No are same Since M-Acct-No and T-Acct-No not equal, Old-Master has no transactions –Old-Master record written to New-Master record as is

) M-Acct-No = T-Acct-No WS-Control-Key set to M-Acct-No WS-Allocated-Switch set to 'YES' because WS-Control-Key and M-Acct-No are same Transactions with T-Acct-No = M-Acct-No processed

) M-Acct-No = T-Acct-No Processing transactions with T-Acct-No = M-Acct-No –Updates posted to New-Master –Additions displayed as errors because WS- Allocated-Switch set to 'YES' (master record with this M-Acct-No already exists) –Deletions move 'NO' to WS-Allocated- Switch to ensure this Old-Master record is not written to New-Master file

) M-Acct-No > T-Acct-No WS-Control-Key set to T-Acct-No WS-Allocated-Switch set to 'NO' because WS-Control-Key not equal to M-Acct-No –No master record exists for this transaction

) M-Acct-No > T-Acct-No Only additions acceptable –Reset WS-ALLOCATED-SWITCH to 'YES' –New-Master record created from transaction record Update or deletion transaction treated as error

13-38 Updating Master Disk in Place May read a master disk record, make changes directly to same record, and rewrite it or update it in place Only two files needed –Master-FileOPEN as I-O –Trans-FileOPEN as INPUT Use REWRITE statement to replace master disk record, currently in storage, that was accessed by preceding READ

13-39 Updating Master Disk in Place To delete a record, establish each record with an activity code field –For example, Code-X = 1 if record is active, or 2 if record is inactive –Probably want this code anyway for various bookkeeping reasons All master records initially active (1 in Code- X) Master record deactivated by changing activity code to 2

13-40 Updating Master Disk in Place New records cannot be added in sequence when file open for I-O Can add records at end of file by opening file in EXTEND mode OPEN EXTEND file-name Disk automatically positioned at end of file, immediately after last record Sort file after records added to arrange them in sequence Issues here, you need to close then open and records are added unsorted

13-41 Chapter Summary Sequential updating by creating new master uses three files –Incoming master file –Transaction file with change records –New output master file that will incorporate all changes

13-42 Chapter Summary Sequential updating technique –All three files must be in sequence by same key field –Record read from each file –Routine performed depends on whether key fields match

13-43 Chapter Summary Sequential updating technique –Transaction record may include coded field to designate update, deletion, addition –Use HIGH-VALUES to ensure all records in both old master and transaction files are processed Balanced line algorithm used for sequential updates

13-44 Chapter Summary Can also update records in sequential file by rewriting them in place –Must open file as I-O Records can be added to end of sequential file –Open in EXTEND mode