File organization & File access
File Organization
Serial file organization
The features of serial file orgnization:
- Records enter file in chronogical order.
- But otherwise, there are no particular order.
- Records can only be accessed sequentially/in sequential order.
- A typical use is for bank to record the transactions of a customer account.
Sequentail file organization
The features of sequential file orgnization:
- The records are ordered in some way, usually sorted according to the values of the key field.
- Records in a sequential file can only be accessed sequentially/in sequential order.
- It is an improvement to serial file organization. It takes shorter time to search a record in a sequential file than in a serial file.
Sequential file organization with fixed-size records
The features of sequential file organization with fixed-size records:
- It’s an improvment to sequential file organization. Each record in the file is of the same size.
- Direct access is possible if an index file is provided. An index file stores the key values and positions of relevant records.
Direct-access (random access) file organization
- The term random access is a lit bit misleading. The alternative direct-access suggests that record can be accessed directedly.
- Usually a hash algorithm is ued to get the postion of a record from its key value. The hash algorithm is implemented as a hash function generally. The function takes in the key value and generats an integer as the postion of the record with the key value. when searching a record in the file, the hash function is used to locate the postion of the record.
- A direct-access file can be access sequentially. The essence of direct-access file organization is to provide the ability to access records directly. Searching a record in a direct-access file is much faster than in a serial or sequentail file.
Methods of file access
Sequential access | Direct access | |
---|---|---|
Serial Organization | √ | × |
Sequential Organization | √ | × |
Sequential Organization with index file | √ | √ |
Direct access organization | √ | √ |