File organisation

Data is stored in files and the computer runs programs that process the data in the files. The files are durable and the data can be processed many times by many different programs.

The data in the file must be organised.

When a file is stored (on eg. hard disk), it is given a name and the operating system keeps a record of the address on the disk where the file is stored.

Files can be moved, re-named, deleted or copied from one storage medium to another. They can have data added to them or removed from them. The data stored in a file may be changed.

 

 

A file is an organised collection of related records.

A record is a collection of related fields.

A field is a single data item.

A master file is the main file for an application - a large file of semi-permanent data. Most data is never changed, but some of the fields may need to be updated occasionally.

A transaction file is a temporary file used to store data which will be used to update the master file.

Example. The diagram shows a small part of a school database which stores information about its pupils.

NUMBER SURNAME FORENAME YEAR FORM DOB
92013 JONES Sidney 12 B 23/04/78
92107 LAIDLAW Lorraine 12 Y 12/11/79
92114 MERRITT Mandy 12 G 08/03/79
92167 NASH Natasha 12 B 19/08/78

There are 4 records displayed.

Each record has 6  fields.

The primary key field is the field which uniquely identifies each record.

The key field in the example is NUMBER

 

 
File operations
Design What fields will be contained in each record?
What types of data in each field?
Which field is the primary key field?
Any special codes to be used?
Any special formatting of data

 

Creation Record structure created.
Primary key field set.
Data entered.

 

Organisation Records sorted into order of a key field.
Order may be ascending or descending.

 

Update Data in some of the records are changed.

 

Process A computer program processes each record of the file in turn.

Example : Searching for a record.