File organization is a technique for storing and arranging data on
secondary storage devices so that it can be retrieved easily when
needed. It includes the physical order and layout of records on
secondary storage devices. The techniques used to write and retrieve
data to and from the storage devices called it access methods.
There are main
three type of files from storage point of view.
-
Sequential files
-
Direct or random files
-
Indexed sequential file
Sequential
Files
In sequential
data files, records are stored on the storage media in a sequence.
No locations are specified for individual records. The records are
stored in an order, one after the other. Similarly, records are also
retrieved in sequential order. It means that records are accessed
one after the other in the same sequence in which they are stored on
the storages devices. For example, to access a particular record
from a data file, all records are searched one by one until the
specified record in found. Therefore, accessing records in
sequential files is very slow.
Direct or
Random files
Direct files are
also referred to as random files. In these files, records are not
stored in a sequence. Each record is stored by specifying a
particular address or location within a file. The address is
calculated against the value of the key field of the record.
Sometimes, the same address is calculated, which creates a problem
to store record. This problem is known as synonym. Data accessing
from direct files is very fast. A record is accessed directly by
specifying its address.
Indexed
Sequential Files
These files can
be processed sequentially as well as randomly. In these files, the
location of individual record is also stored along with data of
record. For this purpose, an index is created to keep the track of
locations of individual records.
Index refers to
the location on the storage media where record is stored. You can
say that an index is just like a table that is used to find out the
location of a particular record. The key fields of the records are
stored separately into the index along with the address of each
record. Usually, an index is created in a new file called index
file. The index file is updated whenever a new record is added or an
existing record is deleted. Indexed file organization is more
effective and fast in accessing data from data file than sequential
file organization. These files occupy more space on the storage
media but accessing speed of records is same as random access files.