A collection of related records used as a single unit is called file. File is also known as data set. Files are stored on different storage media such as hard disk, USB flash drive or optical disc etc. The Employee file may contain the records of hundreds of employees. Each employee’s record consists of same fields but each field contains different data.
Types of File
The types of files are two:
- Usage Point of View
- Functional Point of View
Q. Describe the file types from usage point of view.
The types of files from usage point of view are as follow:
1. Master File:
Master files are used to store the information that remains constant for a long period of time. For example, a college maintains a master file of all students. The file may contain the fields such student Name, Father Name, Address, Phone and Email etc. The master files are the latest updated files. The files are updated when any change in their contents are required. These files are never empty since they are created.
2. Transaction File:
A type of file that stores the input data before processing is called transaction file. It may be temporary file and may exist until the master file is updated. It may also be used to maintain a permanent record of the data about a transaction. For example, a transaction file can be used to store the fee deposited by the student.
3. Backup File:
A type of file that is used to take backup of important data is called backup file. It is a permanent file. It is used to store an additional copy of data. The data can be recovered from this file if the original file is lost or damaged. Backup files are mostly created by using specific software.
Q. Describe the file types from functional point of view.
The files are given proper names from functional point of view. It consist of file name and file extension. The name and extension of a file is separated by dot. The extension is normally assigned by the software in which the file is created.
File types from Functional Point of View
The types of files from functional point of view are as follow:
1. Program file:
A type of file that contain the software instructions is called program file. A program file has an extension of .com or .exe. These files contain the instructions that can be directly executed by the computer.
2. Data File:
A type of file that contain data is called data file. Data file are created by the software being used. Different software store data in the data file using different formats. A data files is generally opened in the same software in which it is created. It can also be opened in different software that supports the format of that data file.
Some examples of data files and software in which they are created are as follows:
Q. How do we organized files on storage media?
A technique for physically arranging the records of a file on secondary storage devices is called file organization. The file are organized on storage media in the following ways:
1. Sequential Files:
The records in sequential file organization are stored in sequence. A sequence means the records are stored one after the other. The records can be retrieved only in the sequence in which they were stored. The primary storage media for sequential files is magnetic tape.
The major disadvantage of sequence access is that it is very slow. It requires more processing time. If the last record is to be retrieved, all preceding records are read before reaching the last record.
2. Direct or Random files:
The records in direct file organization are not stored in a particular sequence. A key value of a record is used to determine the location to store the record. Each record is accessed directly without going through the preceding records.
This file organization is suitable for storing data on disk. Direct file organization is much faster than sequential file organization for finding a specific record. A problem that may occur in this type of files is called synonym. The problem occurs if the same address is calculated to store two or more records.
3. Indexed Sequential Files:
In indexed sequential file organization records are stored in ascending or descending order. The order is based on a value called Key. Additionally, indexed file organization maintain an index in a file.
An index consist of key values and the corresponding disk address for each record in the file. Index refers to the place on a disk where a record is stored. The index file is updated whenever a record is added from the file.
The records in indexed file organization can be accessed in sequential access as well as random access or direct access. The records in this fie type require more space on storage media. This method is slower than direct file organization as it requires to perform an index search.