indexed files continued. figure 17.1 sequential update old master transaction new master error...
TRANSCRIPT
![Page 1: Indexed Files continued. Figure 17.1 Sequential Update OLD MASTER TRANSACTION NEW MASTER ERROR MESSAGES UPDATE PROGRAM](https://reader036.vdocuments.net/reader036/viewer/2022082818/56649ee55503460f94bf5711/html5/thumbnails/1.jpg)
Indexed Files continued
![Page 2: Indexed Files continued. Figure 17.1 Sequential Update OLD MASTER TRANSACTION NEW MASTER ERROR MESSAGES UPDATE PROGRAM](https://reader036.vdocuments.net/reader036/viewer/2022082818/56649ee55503460f94bf5711/html5/thumbnails/2.jpg)
Figure 17.1 Sequential Update
OLD MASTER
TRANSACTION
NEWMASTER
ERRORMESSAGES
UPDATEPROGRAM
![Page 3: Indexed Files continued. Figure 17.1 Sequential Update OLD MASTER TRANSACTION NEW MASTER ERROR MESSAGES UPDATE PROGRAM](https://reader036.vdocuments.net/reader036/viewer/2022082818/56649ee55503460f94bf5711/html5/thumbnails/3.jpg)
Figure 17.2 Sequential Update with Data Files
ERROR MESSAGES:
NO MATCH 500000000DUPLICATE ADDITION 888888888
SEQUENTIALUPDATE
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
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
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
![Page 4: Indexed Files continued. Figure 17.1 Sequential Update OLD MASTER TRANSACTION NEW MASTER ERROR MESSAGES UPDATE PROGRAM](https://reader036.vdocuments.net/reader036/viewer/2022082818/56649ee55503460f94bf5711/html5/thumbnails/4.jpg)
Figure 17.4 Sequential Update with Data Validation
TRANSACTIONFILE
OLD MASTER
STEP 1: EDIT
NEW MASTER
STEP 2: UPDATEVALID
TRANSACTIONS
ERRORMESSAGESERROR
MESSAGES
![Page 5: Indexed Files continued. Figure 17.1 Sequential Update OLD MASTER TRANSACTION NEW MASTER ERROR MESSAGES UPDATE PROGRAM](https://reader036.vdocuments.net/reader036/viewer/2022082818/56649ee55503460f94bf5711/html5/thumbnails/5.jpg)
Figure 17.3 Two-period Sequential Update
MASTERAS OF 1/1
JANUARYTRANSACTIONS
MASTERAS OF 2/1
UPDATEPROGRAM
MASTERAS OF 3/1
UPDATEPROGRAM
FEBRUARYTRANSACTIONS
Processing done February 1
Processing done March 1
![Page 6: Indexed Files continued. Figure 17.1 Sequential Update OLD MASTER TRANSACTION NEW MASTER ERROR MESSAGES UPDATE PROGRAM](https://reader036.vdocuments.net/reader036/viewer/2022082818/56649ee55503460f94bf5711/html5/thumbnails/6.jpg)
Figure 17.7 Pseudocode for Data Validation Program
Open filesDO while data remains READ transaction file AT END
Indicate no more data NOT AT END
Move ‘YES’ to valid-record-switchIF trans-social-security < previous-social-security Move ‘NO’ to valid-record-switch Write error messageENDIFMove trans-social-security to previous-social-securityIF transaction-code is not valid Move ‘NO’ to valid-record-switch Write error messageENDIFIF addition IF transactions fails addition-check(s) Move ‘NO’ to valid-record-switch
Write error message(s) ENDIFELSE IF correction IF sales-amount not numeric
Move ‘NO’ to valid-record-switch Write error message ENDIF ENDIFENDIFIF valid-record-switch = ‘YES’ Write valid-transaction-recordENDIF
ENDREADENDDOClose filesStop run
![Page 7: Indexed Files continued. Figure 17.1 Sequential Update OLD MASTER TRANSACTION NEW MASTER ERROR MESSAGES UPDATE PROGRAM](https://reader036.vdocuments.net/reader036/viewer/2022082818/56649ee55503460f94bf5711/html5/thumbnails/7.jpg)
Figure 18.4 Pseudocode for Creating Indexed File
Open filesDO WHILE data remains READ record from sequential file
AT END Indicate no more dataNOT 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
![Page 8: Indexed Files continued. Figure 17.1 Sequential Update OLD MASTER TRANSACTION NEW MASTER ERROR MESSAGES UPDATE PROGRAM](https://reader036.vdocuments.net/reader036/viewer/2022082818/56649ee55503460f94bf5711/html5/thumbnails/8.jpg)
READINDEXED F ILE
ADD NEWRECO RD
CO RRECTEXISTINGRECO RD
DELETE EXISTINGRECO RD
APPLYTRANS TOMASTER
PRO CESSTRANSACTIO N
F ILE
Figure 18.8 Hierarchy Chart for Nonsequential Update Program
![Page 9: Indexed Files continued. Figure 17.1 Sequential Update OLD MASTER TRANSACTION NEW MASTER ERROR MESSAGES UPDATE PROGRAM](https://reader036.vdocuments.net/reader036/viewer/2022082818/56649ee55503460f94bf5711/html5/thumbnails/9.jpg)
Figure 18.9 Pseudocode for Nonsequential Update ProgramOpen files
DO WHILE data remains READ transaction file
AT END Indicate no more dataNOT 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-recordENDIF
WHEN correctionIF record-key-allocated-switch = ‘YES’ Process correction Rewrite indexed recordELSE (transaction is not in indexed file) Write ‘error - no matching record’ENDIF
WHEN deletionIF record-key-allocated-switch = ‘YES’ Delete indexed recordELSE (transaction is not in indexed file) Write ‘error - no matching record’ENDIF
WHEN otherWrite ‘error - invalid transaction’
END EVALUATE END READEND DOClose FilesStop Run
![Page 10: Indexed Files continued. Figure 17.1 Sequential Update OLD MASTER TRANSACTION NEW MASTER ERROR MESSAGES UPDATE PROGRAM](https://reader036.vdocuments.net/reader036/viewer/2022082818/56649ee55503460f94bf5711/html5/thumbnails/10.jpg)
• The START Statement– Start Filename Key Relational Operator – Invalid Key Statement– Not Invalid Key Statement– End-Start
![Page 11: Indexed Files continued. Figure 17.1 Sequential Update OLD MASTER TRANSACTION NEW MASTER ERROR MESSAGES UPDATE PROGRAM](https://reader036.vdocuments.net/reader036/viewer/2022082818/56649ee55503460f94bf5711/html5/thumbnails/11.jpg)
• 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)