Page 117 - Accounting Information Systems
P. 117
88 PART I Overview of Accounting Information Systems
FI GU RE
2-40 INSERTING A RECORD INTO A VIRTUAL STORAGE ACCESS METHOD FILE
Key 223 Key 224 Key 225
Key 226 Key 228 Key 229
Key 231 Key 233 Key 234
Key 235 Key 238 Key 239 Overflow
Area
Index Key 240 Key 241
Key 237
Prime
Area
Key 269 Key 270
Insert New Record with Key Value = 237
Periodically, the VSAM file must be reorganized by integrating the overflow records into the prime
area and then reconstructing the indexes. This involves time, cost, and disruption to operations. There-
fore, when a file is highly volatile (records are added or deleted frequently), the maintenance burden asso-
ciated with the VSAM approach tends to render it impractical. However, for large, stable files that need
both direct access and batch processing, the VSAM structure is a popular option.
HASHING STRUCTURE
A hashing structure employs an algorithm that converts the primary key of a record directly into a stor-
age address. Hashing eliminates the need for a separate index. By calculating the address, rather than
reading it from an index, records can be retrieved more quickly. Figure 2-41 illustrates the hashing
approach.
This example assumes an inventory file with 100,000 inventory items. The algorithm divides the
inventory number (the primary key) into a prime number. Recall that a prime number is one that can be
divided only by itself and 1 without leaving a residual value. Thus, the calculation will always produce a
value that can be translated into a storage location. Hence, the residual 6.27215705 becomes Cylinder
272, Surface 15, and Record 705. The hashing structure uses a random file organization because the pro-
cess of calculating residuals and converting them into storage locations produces widely dispersed record
addresses.
The principal advantage of hashing is access speed. Calculating a record’s address is faster than
searching for it through an index. This structure is suited to applications that require rapid access to indi-
vidual records in performing Operations 1, 2, 3, and 6 in Table 2-2.