Random update

Download Report

Transcript Random update

Random update
Please use speaker notes for
additional information!
Update
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.
Systems flowchart
Data
Edit
Program
Errors can be put
on disk, printed,
interactively
corrected or any
combination of
solutions.
Valid
Trans
Update
Program
Errors
Master
File
Trail
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.
Random Update
Screen
Transactions
OR
Transactions
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.
Random Update
Program
Errors
Trail
Master
Random Update Logic
Record on the
indexed file
Record not on the
indexed file
Trans = A
(Add)
Error condition
WRITE the record
on the indexed file new record
Trans = C
(Change)
Make changes in
memory
REWRITE the
record on the
indexed file
Error condition
Trans = D
(Delete)
DELETE the record Error condtion
from the indexed
file
start
housekeeping
process
process
readTrans
readTrans
Read a
transaction
Y
not EOF
end-readTrans
loop
N
wrapup
end-process
readMstr
stop
read master
housekeeping
wrapup
Y
N
open files
end-housekeeping
successful
close files
end-wrapup
not success
success
end-readMstr
loop
establish key
read mstr
Y
N
success
N
N
delete
error
routine
change
trans
add
trans
Y
change
error
routine
N
Y
N
add
routine
write
master
add
error
routine
delete
trans
change
trans
Y
delete
routine
delete
master
readTran
end -loop
Y
change
routine
rewrite
master
Random Update
ERROR /TRAIL
MASTER (before)
TRANSACTIONS
MASTER (after)
121...
121…
C
121...
123…
124…
A
123…
222...
222…
C
222...
234…
222…
C
234…
333...
333…
D
333...
345…
350…
C
345…
444...
444…
A
444...
456…
450…
D
456…
512…
999...
512…
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.
REPORT
121 (trail)
Random Update
MASTER (after)
ERROR /TRAIL
MASTER (before)
TRANSACTIONS
121...
121…
C
121...
121 (trail)
123…
124…
A
123…
124 (trail)
222...
222…
C
124...
234…
222…
C
222...
333...
333…
D
234…
345…
350…
C
333...
444...
444…
A
345…
456…
450…
D
444...
512…
999...
456…
512…
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.
REPORT
Random Update
ERROR /TRAIL
MASTER (before)
TRANSACTIONS
MASTER (after)
121...
121…
C
121...
121 (trail)
123…
124…
A
123…
124 (trail)
222...
222…
C
124...
222 (trail)
234…
222…
C
222...
333...
333…
D
234…
345…
350…
C
333...
444...
444…
A
345…
456…
450…
D
444...
512…
999...
REPORT
456…
512…
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.
Random Update
ERROR /TRAIL
MASTER (before)
TRANSACTIONS
MASTER (after)
121...
121…
C
121...
121 (trail)
123…
124…
A
123…
124 (trail)
222...
222…
C
124...
222 (trail)
234…
222…
C
222...
222 (trail)
333...
333…
D
234…
345…
350…
C
333...
444...
444…
A
345…
456…
450…
D
444...
512…
999...
REPORT
456…
512…
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.
Random Update
ERROR /TRAIL
MASTER (before)
TRANSACTIONS
MASTER (after)
121...
121…
C
121...
121 (trail)
123…
124…
A
123…
124 (trail)
222...
222…
C
124...
222 (trail)
234…
222…
C
222...
222 (trail)
333...
333…
D
234…
333 (trail)
345…
350…
C
345…
444...
444…
A
444...
456…
450…
D
456…
512…
999...
REPORT
512…
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.
Random Update
MASTER (after)
ERROR /TRAIL
MASTER (before)
TRANSACTIONS
121...
121…
C
121...
121 (trail)
123…
124…
A
123…
124 (trail)
222...
222…
C
124...
222 (trail)
234…
222…
C
222...
222 (trail)
333...
333…
D
234…
333 (trail)
345…
350…
C
345…
350 (error)
444...
444…
A
444...
456…
450…
D
456…
512…
999...
512…
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.
REPORT
Random Update
ERROR /TRAIL
MASTER (before)
TRANSACTIONS
121...
121…
C
121...
121 (trail)
123…
124…
A
123…
124 (trail)
222...
222…
C
124...
222 (trail)
234…
222…
C
222...
222 (trail)
333...
333…
D
234…
333 (trail)
345…
350…
C
345…
350 (error)
444...
444…
A
444...
444 (error)
456…
450…
D
456…
512…
MASTER (after)
REPORT
512…
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.
Random Update
TRANSACTIONS
121...
121…
C
121...
121 (trail)
123…
124…
A
123…
124 (trail)
222...
222…
C
124...
222 (trail)
234…
222…
C
222...
222 (trail)
333...
333…
D
234…
333 (trail)
345…
350…
C
345…
350 (error)
444...
444…
A
444...
444 (error)
456…
450…
D
456…
450 (error)
512…
MASTER (after)
ERROR /TRAIL
MASTER (before)
512…
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.
REPORT
Random Update with unsorted transactions
MASTER (before)
TRANSACTIONS
MASTER (after)
121...
350…
C
121...
123…
222…
C
123…
222...
124…
A
222...
234…
450…
D
234…
333...
333…
D
333...
345…
121…
C
345…
444...
444…
A
444...
456…
222…
C
456…
512…
999...
512…
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.
350 (error)
Random Update with unsorted transations
ERROR /TRAIL
MASTER (before)
TRANSACTIONS
MASTER (after)
121...
350…
C
121...
350 (error)
123…
222…
C
123…
222 (trail)
222...
124…
A
124...
234…
450…
D
222...
333...
333…
D
234…
345…
121…
C
333...
444...
444…
A
345…
456…
222…
C
444...
512…
999...
REPORT
456…
512…
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.
Random Update with unsorted transactions
MASTER (after)
ERROR /TRAIL
MASTER (before)
TRANSACTIONS
121...
350…
C
121...
350 (error)
123…
222…
C
123…
222 (trail)
222...
124…
A
124...
124 (trail)
234…
450…
D
222...
333...
333…
D
234…
345…
121…
C
333...
444...
444…
A
345…
456…
222…
C
444...
512…
999...
456…
512…
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.
REPORT