Presentation is loading. Please wait.

Presentation is loading. Please wait.

Indexed Files continued. Figure 17.1 Sequential Update OLD MASTER TRANSACTION NEW MASTER ERROR MESSAGES UPDATE PROGRAM.

Similar presentations


Presentation on theme: "Indexed Files continued. Figure 17.1 Sequential Update OLD MASTER TRANSACTION NEW MASTER ERROR MESSAGES UPDATE PROGRAM."— Presentation transcript:

1 Indexed Files continued

2 Figure 17.1 Sequential Update OLD MASTER TRANSACTION NEW MASTER ERROR MESSAGES UPDATE PROGRAM

3 Figure 17.2 Sequential Update with Data Files ERROR MESSAGES: NO MATCH500000000 DUPLICATE ADDITION888888888 SEQUENTIAL UPDATE OLD MASTER FILE: 111111111ADAMS015000 NEW YORK 222222222BAKER025000 NEW YORK 333333333ZIDROW008000 NEW YORK 444444444MILGROM040000 BOSTON 555555555BENJAMIN100000 CHICAGO 666666666SHERRY007500 CHICAGO 777777777BOROW017500 BOSTON 888888888JAMES050000 NEW YORK 999999999RENAZEV030000 NEW YORK TRANSACTION FILE: 222222222028000 C 222222222 BOSTON C 400000000NEW EMPLOYEE016000 BOSTON A 500000000020000 C 610000000NEW EMPLOYEE II018000 CHICAGO A 610000000 NEW YORK C 666666666SHERRY D 777777777055000 C 888888888JAMES017500 NEW YORK A NEW MASTER FILE: 111111111ADAMS015000 NEW YORK 222222222BAKER025000 NEW YORK 333333333ZIDROW008000 NEW YORK 444444444MILGROM040000 BOSTON 400000000NEW EMPLOYEE016000 BOSTON 555555555BENJAMIN100000 CHICAGO 610000000NEW EMPLOYEE II018000 NEW YORK 666666666SHERRY007500 CHICAGO 777777777BOROW017500 NEW YORK 888888888JAMES050000 NEW YORK 999999999RENAZEV030000 NEW YORK

4 Figure 17.4 Sequential Update with Data Validation TRANSACTION FILE OLD MASTER STEP 1: EDIT NEW MASTER STEP 2: UPDATE VALID TRANSACTIONS ERROR MESSAGES

5 Figure 17.3 Two-period Sequential Update MASTER AS OF 1/1 JANUARY TRANSACTIONS MASTER AS OF 2/1 UPDATE PROGRAM MASTER AS OF 3/1 UPDATE PROGRAM FEBRUARY TRANSACTIONS Processing done February 1 Processing done March 1

6 Figure 17.7 Pseudocode for Data Validation Program Open files DO 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 ENDREAD ENDDO Close files Stop run

7 Figure 18.4 Pseudocode for Creating Indexed File Open files DO 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 ENDREAD ENDDO Close files Stop run

8 Figure 18.8 Hierarchy Chart for Nonsequential Update Program

9 Figure 18.9 Pseudocode for Nonsequential Update Program Open files DO 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 READ END DO Close Files Stop 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)


Download ppt "Indexed Files continued. Figure 17.1 Sequential Update OLD MASTER TRANSACTION NEW MASTER ERROR MESSAGES UPDATE PROGRAM."

Similar presentations


Ads by Google