Computer files can be organised in serial or sequential order.
A serial file is where records are not stored in any particular order e.g. the amount of gas used by a customer read from their gas meter. They are stored in a serial file called a transaction file.
To add to a serial file the new record is appended to the end of the file.
A sequential file is where records are stored in (primary key) order e.g. Details about each customer and their previous gas usage are stored in a sequential file called the master file.
To add to a sequential file,
a new file is made by copying the old file until an insertion is required
then inserting the new record
and copying the rest of the file
(Another method for adding to a sequential file is the new record is appended to the end of the file and then the file is sorted whereas to add to a serial file the record is just appended to the end).
CASE STUDY 1 - Utility Company for Electricity Bills
An electricity supply company uses serial and sequential files.
The amount of electricity used by each customer is read from their electricity meter and stored in a serial file called the transaction file.
The serial file is the most suitable because meter readings are not taken in any order.
The details about each customer and their previous electricity usage are stored in a sequential file called the master file.
The sequential file is the most suitable because customer records are processed in order. It is also easier/quicker to search a sequential file for a record.
When the electricity company produces customer bills the master file is updated using a transaction file. The diagram below shows the sequential file update process and clearly shows the following:-
Two input files: (old/current) master file and sorted transaction file
Explanation of update process i.e. comparison, record by record, with update where appropriate
Updated (new) master file as output
Bills as output
CASE STUDY 2 - Payroll
An employment agency recruits employees for businesses. The Agency is responsible for paying the employees, calculating tax and national insurance. Each employee is paid a different hourly rate.
The employee pay details, including their hourly rate are stored in a master file. The number of hours each employee works each month is entered and stored in a transaction file.
At the end of each month the hours worked by the employee and the hourly rate are used to calculate the month's pay, tax and national insurance.
The serial file is the most suitable because hours worked are entered in no particular order.
The sequential file is the most suitable because employee records are processed in order. They need to be accessed in order for the update process to be carried out.
It is also easier/quicker to search a sequential file for a record.
Field = A field is a single item of data e.g. Employee Number
Record = A Record is a collection of items all relating to an object and is treated as a unit for processing. A record is a collection of related fields.
File - A file is a collection of related records.
The table below shows example fields that would be recorded in the employee master file.
The transaction file and the master file are both used to produce a pay slip for every employee. This is completed by going through the following process:-
Transaction file is sorted into the same order as the old master file.
Each transaction record is read and used to update the corresponding record from the old master file.
The diagram below represents this process:
Two input files: old master file and sorted transaction file
Update Process i.e. comparison record by record with corresponding master record and the master record is updated where appropriate
New (updated) master file and pay slip are the outputs of the process. When drawing a diagram please make sure the arrows clearly show the flow of record.
After the last transaction record is processed, the remaining old master records are read from the old master file and written to the new master file.
The table below shows an example of a design of a customer record stored in the master file.