Direct-Access File Design


Direct access file design also uses the key field of the records but in a different way from sequential design. The key field provides the only way of accessing data within a direct access file design. Therefore, records are not stored in any particular order.

The data record being sought is retrieved according to its key value, so records before or after it are not read. Generally this key is a memory or disk address for a particlar record or file. The address is usually a number from five to seven digits that is related to the physical characteristics of the storage medium. When a file is created, this address determines where the record is written. During retrieval, the address determines where to locate the record. Another way to obtain the address of a record is to place the record keys and their corresponding addresses in a directory (see Figure below). During processing, the computer searches the directory to locate the address of a particular record.

Sample Directory for Social Security Number

Direct-access file design is much more efficient than searching an entire data file for a particular record. It is useful when information must be updated and retrieved quickly and when current information is crucial. A common application of direct-access file organization is for airline seat reservations. Current information about available flights and seats must be available at all times so that flights are not overbooked. Virtually all modern computer systems today use a Direct Access file mechanism when opening and running computer applications. This includes portable and desktop computers as you are using now.

In contrast to a batch-processing system, a direct-access system does not require transaction records to be grouped or sorted before they are processed. Data is submitted to the computer in the order it occurs, usually using an online access method. Direct-access storage devices (DASDs), such as magnetic disk drive units, make this type of processing possible. A particular record on a master file can be accessed directly, using its assigned address or keys, and updated without all preceding records on the file being read. Only the key to the record needs to be known. Thus, up-to-the-minute reports can be provided.

With direct-access processing, the computer can locate the record to be updated without processing all records that precede it. This next Figure shows how direct-access processing would be used in a business.

Direct Access Processing

MAKING INQUIRIES TO DIRECT-ACCESS FILES

Consider again the two inquiries discussed in connection with sequential files. This time the inquiries will be made to direct-access files.
 

  1. List the records of employees with social security numbers 234-02-1532 and 372-84-7436.

    With the social security number as the key to the employee file, these two employee records can be located directly. The computer retrieves each record from the address assigned for each social security number. It does not have to read all the records in the file.
     

  2. List all employees from the area with zip code 43403.

    The approach used for this inquiry will depend on the organization of the file. If the file is large and much processing is done based on a geographic breakdown of employees, a directory using zip codes and their record addresses can be created (as in the Figure below).

    However, if there are not many employees and processing is seldom based on the geographic breakdown of employees, a directory to locate employee records by zip code may have little value. In this case, the situation is the same as with sequential files-the entire file must be read to obtain the desired information.

ASSESSMENT OF DIRECT-ACCESS FILE DESIGN

Direct-access processing and file design is suitable for applications with low activity and high volatility. Examples of such applications (systems requiring only a few records to be updated frequently) include banking operations and hotel and airline reservation systems.

Advantages of direct-access processing and file design are the following:

Disadvantages of direct-access design include the following:


Last Updated Jan.6/99