VRS

File Organisation


Serial File


Definition

A file structure where, the data is stored in the order in which it arrives.


Adding New Data

To insert new data to s serial file, it is simply added to the end of the file. This is called appending the data.


Deleting Data

In order to delete an item of data without leaving a gap in the file:


Searching for Data

To search for an item in a serial file, the computer starts from the beginning, and looks at each item in turn, until it finds the record it is looking for. If the item being searched for is not in the file, the computer will have to search everything until it realises this.


Sequential File


Definition

In a sequential file the data is stored according to a key field in the data. This key field is unique, and used to identify each record.


Adding New Data

The new item must be inserted within the existing records. This is done by recreating the file, all the records up to where the new record should go are copied to the new file, then the new record is inserted, then all the records after the new record are copied across. The new file then replaces the old file.


Deleting Data

So as not to have a gap in the file where the deleted data was, the same method used for a serial file is used. A new file is created containing all the data except the item to be deleted, this new file replaces the old file.


Searching for Data

To search for an item of data, start at the first item and look at each item unitl you find what you are looking for. However, if you find an item of data higher than what your looking for, your data is not in the file, and the search can be stopped. This saves time.


Indexed Sequential Files


Definition

An indexed sequential file is a sequential file where the data is arranged according to a key field in the record, but which also has an index allowing data to be found directly.


File Operations

Adding, searching and deleting items of data can be done in the same way as in a sequential file. The main difference is that it is also possible to go strait to a particular record using the index rather than searching everything.


Direct-Access Files


Definition

Where the records in a sequential file have a fixed length, so their address can be calculated from their position.


Example

If the size of a record is 40 bytes, then the records file will be from 0, 40, 80, 120, 160... To find the tenth record just multiply the size of the record by the position (remember it starts at zero, not one). So the 10th record will be at the 400th byte.

An over complicated formula for this simple process could be given by:

Address of Record number, n = beginning of file + ((n-1) * Size of record)


Random Files


Definition

Allows data to be stored anywhere in a dedicated area of the disk.


Calculating Address of Data

A hash algorithm is performed on a field in the record to be stored. This can then be used to find the address of records once they are stored. Very useful for large databases, where records are accessed individually.

Title


File Organisation.html

Type


web

Download


Back


Switch to New Version