Random update

18
Random update Please use speaker notes for additional information!

description

Random update. Please use speaker notes for additional information!. Update. Random Update. - PowerPoint PPT Presentation

Transcript of Random update

Page 1: Random update

Random update

Please use speaker notes for additional information!

Page 2: Random update

• EDIT: The transactions that will be used in the update must be as error free as possible to prevent corrupting the master file. To assure the integrity of the data, the transactions can be processed in an edit program and only valid transactions should be allowed to update the master file. The output of the edit file includes the valid (good) transaction file which will be processed in the next step. Frequently transaction come in via a screen and the analyst decides that the editing will be incorporated in the update program to provide interactivity.

• UPDATE: The update program uses the valid transaction file to update the master file itself. No new master file is created, the changes are made to the existing master file. Note that random updating is transaction driven. This means that you read the transaction file and find the master that needs to be updated. When you have processed all of the transactions, the processing is done. Reports become extremely important to provide a paper trail of records processed and also a trail of records that contained errors and were not processed. In a maintenance update there can be add, change or delete transactions so records can be added to the existing master, changed on the existing master, or deleted from the existing master. The method of physically handling deletes varies depending on technology being used.. The update program completes the updating maintenance cycle. Note that back up does not happen automatically in a random update. Copies of the master file and the transaction file need to be made. Frequently the master is backed up directly after the update. It absolutely has to be backed up before the next update.

Random UpdateUpdateUpdate

Page 3: Random update

Data EditProgram Valid

Trans

Errors can be put on disk, printed, interactively corrected or any combination of solutions.

MasterFile

UpdateProgram

Errors

Note: Errors can be written to disk, printed, interactively corrected or any combination of solutions. An optional paper trail can also be produced on disk, paper or another medium.

Trail

Systems flowchartSystems flowchart

Page 4: Random update

Transactions MasterRandom Update

Program

If transactions are coming in as a group from a disk file, they should be edited. If the transactions are coming from a screen, interactive editing should take place in the Random Update Program. The user will frequently try to interactively handle errors on the screen.

Screen Transactions

OR

Errors

Trail

Random UpdateRandom Update

Page 5: Random update

Random Update LogicRandom Update Logic

Record on theindexed file

Record not on theindexed file

Trans = A(Add)

Error condition WRITE the recordon the indexed file -new record

Trans = C(Change)

Make changes inmemoryREWRITE therecord on theindexed file

Error condition

Trans = D(Delete)

DELETE the recordfrom the indexedfile

Error condtion

Page 6: Random update

start

housekeeping

process

wrapup

stop

housekeeping

open files

end-housekeeping

process

readTrans

not EOFY

end-process

loop

wrapup

close files

end-wrapup

readTrans

end-readTrans

Read atransaction

readMstr

end-readMstr

read master

successful

success not success

YN

N

Page 7: Random update

loop

establish key

read mstr

success

changetrans

changeroutine

rewritemaster

Y

YN

deletetrans

Y

deleteroutine

N

adderror

routinedeletemaster

N

addtrans

addroutine

writemaster

Y

changetrans

N

deleteerror

routine

changeerror

routine

Y

N

readTran

end -loop

Page 8: Random update

MASTERMASTER (before)

121...

123…

222...

234…

333...

345…

444...

456…

512…

TRANSACTIONSTRANSACTIONS

121… C

124… A

222… C

222… C

333… D

350… C

444… A

450… D

999...

MASTER MASTER (after)

ERRORERROR /TRAIL /TRAIL REPORTREPORT

Random UpdateRandom Update

The transaction is read and then there is an attempt made to find the matching record identification number on the Master. If a match is found, changes are made to the record on the master and the record is put back on the master with a REWRITE. A trail of the change is also made.

121...

123…

222...

234…

333...

345…

444...

456…

512…

121 (trail)

Page 9: Random update

MASTER MASTER (before)

121...

123…

222...

234…

333...

345…

444...

456…

512…

TRANSACTIONSTRANSACTIONS

121… C

124… A

222… C

222… C

333… D

350… C

444… A

450… D

999...

MASTER MASTER (after)ERRORERROR /TRAIL /TRAIL REPORTREPORT

Random UpdateRandom Update

The transaction is read and then there is an attempt made to find the matching record identification number on the Master. Since no match is found and this is an add, the new record is written on the Master using a WRITE. A trail of the add is also made.

121...

123…

124...

222...

234…

333...

345…

444...

456…

512…

121 (trail)

124 (trail)

Page 10: Random update

MASTER MASTER (before)

121...

123…

222...

234…

333...

345…

444...

456…

512…

TRANSACTIONSTRANSACTIONS

121… C

124… A

222… C

222… C

333… D

350… C

444… A

450… D

999...

MASTER MASTER (after)ERRORERROR /TRAIL /TRAIL REPORTREPORT

Random UpdateRandom Update

The transaction is read and then there is an attempt made to find the matching record identification number on the Master. Since a match is found and this is a change, the change is made and the changed Master replaces the original record on the master using the REWRITE. A trail of the change is also made.

121...

123…

124...

222...

234…

333...

345…

444...

456…

512…

121 (trail)

124 (trail)

222 (trail)

Page 11: Random update

MASTER MASTER (before)

121...

123…

222...

234…

333...

345…

444...

456…

512…

TRANSACTIONSTRANSACTIONS

121… C

124… A

222… C

222… C

333… D

350… C

444… A

450… D

999...

MASTER MASTER (after)ERRORERROR /TRAIL /TRAIL REPORTREPORT

Random UpdateRandom Update

The transaction is read and then there is an attempt made to find the matching record identification number on the Master. Since a match is found and this is a change, the change is made and the changed Master replaces the original record on the master using the REWRITE. A trail of the change is also made.

121...

123…

124...

222...

234…

333...

345…

444...

456…

512…

121 (trail)

124 (trail)

222 (trail)

222 (trail)

Page 12: Random update

MASTER MASTER (before)

121...

123…

222...

234…

333...

345…

444...

456…

512…

TRANSACTIONSTRANSACTIONS

121… C

124… A

222… C

222… C

333… D

350… C

444… A

450… D

999...

MASTER MASTER (after)ERRORERROR /TRAIL /TRAIL REPORTREPORT

Random UpdateRandom Update

The transaction is read and then there is an attempt made to find the matching record identification number on the Master. Since a match is found and this is an delete, the delete is made by removing the record from the Master using the DELETE verb. A trail of the delete is also made.

121...

123…

124...

222...

234…

345…

444...

456…

512…

121 (trail)

124 (trail)

222 (trail)

222 (trail)

333 (trail)

Page 13: Random update

MASTER MASTER (before)

121...

123…

222...

234…

333...

345…

444...

456…

512…

TRANSACTIONSTRANSACTIONS

121… C

124… A

222… C

222… C

333… D

350… C

444… A

450… D

999...

MASTER MASTER (after)ERRORERROR /TRAIL /TRAIL REPORTREPORT

Random UpdateRandom Update

The transaction is read and then there is an attempt made to find the matching record identification number on the Master. Since no match is found and this is a change, no change is made to the master. A report of the change error is also made.

121...

123…

124...

222...

234…

345…

444...

456…

512…

121 (trail)

124 (trail)

222 (trail)

222 (trail)

333 (trail)

350 (error)

Page 14: Random update

MASTER MASTER (before)

121...

123…

222...

234…

333...

345…

444...

456…

512…

TRANSACTIONSTRANSACTIONS

121… C

124… A

222… C

222… C

333… D

350… C

444… A

450… D

MASTER MASTER (after)ERRORERROR /TRAIL /TRAIL REPORTREPORT

Random UpdateRandom Update

The transaction is read and then there is an attempt made to find the matching record identification number on the Master. Since a match is found and this is a add, no change is made to the master. A report of the add error is also made.

121...

123…

124...

222...

234…

345…

444...

456…

512…

121 (trail)

124 (trail)

222 (trail)

222 (trail)

333 (trail)

350 (error)

444 (error)

Page 15: Random update

MASTER MASTER (before)

121...

123…

222...

234…

333...

345…

444...

456…

512…

TRANSACTIONSTRANSACTIONS

121… C

124… A

222… C

222… C

333… D

350… C

444… A

450… D

MASTER MASTER (after)ERRORERROR /TRAIL /TRAIL REPORTREPORT

Random UpdateRandom Update

The transaction is read and then there is an attempt made to find the matching record identification number on the Master. Since no match is found and this is a delete, no change is made to the master. A report of the delete error is also made.

121...

123…

124...

222...

234…

345…

444...

456…

512…

121 (trail)

124 (trail)

222 (trail)

222 (trail)

333 (trail)

350 (error)

444 (error)

450 (error)

Page 16: Random update

MASTERMASTER (before)

121...

123…

222...

234…

333...

345…

444...

456…

512…

TRANSACTIONSTRANSACTIONS

350… C

222… C

124… A

450… D

333… D

121… C

444… A

222… C

999...

MASTER MASTER (after)

Random Update with unsorted transactionsRandom Update with unsorted transactions

The transaction is read and then there is an attempt made to find the matching record identification number on the Master. Since no match is found and this is a change, no change is made to the master. A report of the change error is also made.

121...

123…

222...

234…

333...

345…

444...

456…

512…

350 (error)

Page 17: Random update

MASTER MASTER (before)

121...

123…

222...

234…

333...

345…

444...

456…

512…

MASTER MASTER (after)ERRORERROR /TRAIL /TRAIL REPORTREPORT

Random Update with unsorted transationsRandom Update with unsorted transations

The transaction is read and then there is an attempt made to find the matching record identification number on the Master. Since a match is found and this is a change, the change is made and the changed Master replaces the original record on the master using the REWRITE. A trail of the change is also made.

121...

123…

124...

222...

234…

333...

345…

444...

456…

512…

350 (error)

222 (trail)

TRANSACTIONSTRANSACTIONS

350… C

222… C

124… A

450… D

333… D

121… C

444… A

222… C

999...

Page 18: Random update

MASTER MASTER (before)

121...

123…

222...

234…

333...

345…

444...

456…

512…

MASTER MASTER (after)ERRORERROR /TRAIL /TRAIL REPORTREPORT

Random Update with unsorted transactionsRandom Update with unsorted transactions

The transaction is read and then there is an attempt made to find the matching record identification number on the Master. Since no match is found and this is an add, the new record is written on the Master using a WRITE. A trail of the add is also made.

121...

123…

124...

222...

234…

333...

345…

444...

456…

512…

350 (error)

222 (trail)

124 (trail)

TRANSACTIONSTRANSACTIONS

350… C

222… C

124… A

450… D

333… D

121… C

444… A

222… C

999...