b_book1.gif (162 bytes)Data - Organisation | Data processing

Relative file

dadskrf.gif (8645 bytes)

Relative Access

Access may be Relative where the actual location of a record in the file is determined by the value of specified key field(s).

  • Features:
    • Actual location of a record in the file is determined by the value of specified key field(s).
  • Examples:
    • The key value IS the location.

dadorel1.jpg (16183 bytes)

Random Access

Access may be Random where the key value is programmatically transformed (randomised/hashed), to convert it to a specific location (address).

  • Features
    • Access is direct.
    • The same key value always converts to the same location.
    • Records all have same length
    • Access is very fast. To compute the record position in the file only needs a computation using a formula such as;
      (file_start_position + (record_number - 1) * record_length)
    • Records have no order
    • All (blank) records must be created when the file is created, and will contain many holes.
    • Note: Contention may occur - where two records hash to the same location.(Handled using a bucket for overflowing records. If the bucket becomes too large the hashing algorithm needs to be revised).
  • Examples:
    • Divide key by prime number
    • Extract selected characters from key
    • With a numeric key, divide the key by the size of the file and use the remainder (+1) to get the location.

Examples

Advantages

  • Single access/retrieval
  • Updates written to the same location
  • Fast
  • Good for low hit rate
  • File has no order (good for security).

Disadvantages

  • Must use a direct access storage device
  • Control required for backup & security
  • Wastes space
  • Algorithm (hashing) very difficult
  • File has no order (no sequential access possible).

[Rev 09/03/99] 2/7/97 © 1997-99 V/2-Com (Verhaart), P O Box 8415, Havelock North, New Zealand.