1 / 11

Indexed Files continued

Indexed Files continued. OLD MASTER. TRANSACTION. NEW MASTER. UPDATE PROGRAM. ERROR MESSAGES. Figure 17.1 Sequential Update. Figure 17.2 Sequential Update with Data Files. OLD MASTER FILE:

courtneyott
Download Presentation

Indexed Files continued

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Indexed Files continued

  2. OLD MASTER TRANSACTION NEWMASTER UPDATEPROGRAM ERRORMESSAGES Figure 17.1 Sequential Update

  3. Figure 17.2 Sequential Update with Data Files OLD MASTER FILE: 111111111ADAMS 015000 NEW YORK222222222BAKER 025000 NEW YORK333333333ZIDROW 008000 NEW YORK444444444MILGROM 040000 BOSTON555555555BENJAMIN 100000 CHICAGO666666666SHERRY 007500 CHICAGO777777777BOROW 017500 BOSTON888888888JAMES 050000 NEW YORK 999999999RENAZEV 030000 NEW YORK NEW MASTER FILE: 111111111ADAMS 015000 NEW YORK222222222BAKER 025000 NEW YORK333333333ZIDROW 008000 NEW YORK444444444MILGROM 040000 BOSTON 400000000NEW EMPLOYEE 016000 BOSTON 555555555BENJAMIN 100000 CHICAGO 610000000NEW EMPLOYEE II 018000 NEW YORK666666666SHERRY 007500 CHICAGO777777777BOROW 017500 NEW YORK888888888JAMES 050000 NEW YORK999999999RENAZEV 030000 NEW YORK SEQUENTIALUPDATE TRANSACTION FILE: 222222222 028000 C222222222 BOSTON C400000000NEW EMPLOYEE 016000 BOSTON A500000000 020000 C610000000NEW EMPLOYEE II 018000 CHICAGO A610000000 NEW YORK C 666666666SHERRY D777777777 055000 C888888888JAMES 017500 NEW YORK A ERROR MESSAGES: NO MATCH 500000000 DUPLICATE ADDITION 888888888

  4. TRANSACTIONFILE OLD MASTER NEW MASTER VALIDTRANSACTIONS STEP 1: EDIT STEP 2: UPDATE ERRORMESSAGES ERRORMESSAGES Figure 17.4 Sequential Update with Data Validation

  5. MASTERAS OF 1/1 JANUARYTRANSACTIONS MASTERAS OF 2/1 MASTERAS OF 3/1 FEBRUARYTRANSACTIONS Figure 17.3 Two-period Sequential Update UPDATEPROGRAM UPDATEPROGRAM Processing done March 1 Processing done February 1

  6. Open filesDO while data remains READ transaction file AT END Indicate no more data NOT AT END Move ‘YES’ to valid-record-switch IF trans-social-security < previous-social-security Move ‘NO’ to valid-record-switch Write error message ENDIF Move trans-social-security to previous-social-security IF transaction-code is not valid Move ‘NO’ to valid-record-switch Write error message ENDIF IF addition IF transactions fails addition-check(s) Move ‘NO’ to valid-record-switch Write error message(s) ENDIF ELSE IF correction IF sales-amount not numeric Move ‘NO’ to valid-record-switch Write error message ENDIF ENDIF ENDIF IF valid-record-switch = ‘YES’ Write valid-transaction-record ENDIF ENDREADENDDOClose filesStop run Figure 17.7 Pseudocode for Data Validation Program

  7. Figure 18.4 Pseudocode for Creating Indexed File Open filesDO WHILE data remains READ record from sequential file AT END Indicate no more data NOT AT END Move sequential record to indexed record Write indexed record IF sequence error Display error - record out of sequence ENDIF IF duplicate record Display error - record already exists ENDIF ENDREADENDDOClose filesStop run

  8. Figure 18.8 Hierarchy Chart for Nonsequential Update Program

  9. Figure 18.9 Pseudocode for Nonsequential Update Program Open filesDO WHILE data remains READ transaction file AT END Indicate no more data NOT AT END Move transaction social security number to record key READ INDEXEC-FILE INVALID KEY Move ‘NO’ TO record-key-allocated-switch NOT INVALID KEY Move ‘YES’ TO record-key-allocated-switch END-READ EVALUATE WHEN addition IF record-key-allocated-switch = ‘YES’ Write ‘error - duplicate addition’ ELSE (transaction is not in indexed file) Move transaction-record to new-master-record Write indexed-record ENDIF WHEN correction IF record-key-allocated-switch = ‘YES’ Process correction Rewrite indexed record ELSE (transaction is not in indexed file) Write ‘error - no matching record’ ENDIF WHEN deletion IF record-key-allocated-switch = ‘YES’ Delete indexed record ELSE (transaction is not in indexed file) Write ‘error - no matching record’ ENDIF WHEN other Write ‘error - invalid transaction’ END EVALUATE END READEND DOClose FilesStop Run

  10. The START Statement • Start Filename Key Relational Operator • Invalid Key Statement • Not Invalid Key Statement • End-Start

  11. Read Next • Read Filename Next Record • At End Statement • End-Read • File Status (Select Filename File Status is WS-STATUS) • Refer to pages 484 - 485)

More Related