Page 125 - Accounting Information Systems
P. 125
96 PART I Overview of Accounting Information Systems
FI GU RE
2-47 PROGRAM FLOWCHART OF SEQUENTIAL FILE UPDATE LOGIC
Start
Start-up
Read
T
Read
M (parent)
no
T<M T=M Update
Error Compare M in Read EOF
procedure keys T
memory
yes
T>M
Stop Write Write
updated (child) (child) updated
M to new M to new End
master master Procedures
Read (parent) Read
M M
(parent)
Update yes no
Loop Stop EOF Write
to new
master
(child)
T>M. The normal change in the key value relationship is for T to become greater than M. This is so
because both T and M are sorted in ascending order (Assumption 3). The T > M relation signifies that
processing on the current master record is complete. The updated master (currently stored in computer
memory) is then written to a new master file—the child—and a new M record is read from the original
(parent) file.
Because the transaction file represents a subset of the master (Assumption 1), there normally will
be gaps between the key values of the transaction records. Figure 2-48 illustrates this with sample transac-
tions and corresponding master file records. Notice the gap between Key 1 and Key 4 in the transaction
file. When Key 4 is read into memory, the condition T > M exists until Master Record 4 is read. Before
this, Master Records 2 and 3 are read into memory and then immediately written to the new master with-
out modification.
T<M. The T < M key relationship signifies an error condition. The key of the current T record should
only be smaller than that of the current M record if a T record is out of sequence (Assumption 4). For an