File Organization
File Organization
File Organization
File organization and access relates to the use of records, fields and files.
A record is a collection of related data items (possibly of different types) stored in fields and :
treated as a single entity for processing.
A field contains a single data item, and many fields comprise a record. Each field has a name and
one is the key field used to identify the record.
A data file is a collection of records holding the same types of information but about different
objects or individuals.
2. The way in which the records of the file are organized on the secondary storage device. This is
called file organization.
A transaction file is a temporary file which is used to update the master file after a certain time
(at the end of each day or week, for example). The transaction file updates the master file. The records
in the transaction file are used to perform three important operations:
There is also another file, known as the change file or transaction log, which keeps a record of
changes to the transaction file. This is important, as many businesses need to record the history of
what transactions have taken place and not just the latest one.
Record matching
A primary key is normally used to identify the record you want to update or delete. It is a field in
the record whose value is unique to that record -. For instance, in a student record, the StudentId is
normally used as the key field. Without a key field to identify the record you want you cannot delete or
update records.
To delete or update records in a master file, compare the primary key in the transaction record
with that
in the master file record. If there is a match, you can update or delete the master file record. If
1
both files are ordered on the key field, then this record matching operation functions correctly,
but if either the transaction or the master file is unordered, record matching cannot work.
The system flow chart for the process is shown in Fig 5.19. There are two input files, the old
master file or grandfather file, and the transaction file. There is one output file called the new
master file. The pseudocode for the update process is as follows. The 'EoF' marker is an end of
file marker placed in the file directly after the last record thus allowing a variable number of
records to be stored.
A file is an entire set of data. For example, Star Manufacturing has a file in its database
that contains information about all its suppliers. A file can be a collection of as many
records as needed.
A record is a subset of data (a collection of fields) found in a file. Each record in Star
Manufacturing's file refers to a supplier.
A field is a piece of data contained in a record. Each record in Star Manufacturing's
database contains fields with information about the supplier's name, address, type of
product they supply, payment details, and so on.
Database
FILE
Field 1
Field2
Field 3
Record 1 Record 2 Record 3
Sequential file ordering is where records are stored in a logical order. Records can be
arranged according to name, date, size or any other field. In an office environment, many
records are kept in sequential order, such as employee details, payroll information and
customer records. It makes sense to sort them in sequential order, such as alphabetical order,
so they are easier to understand if you have to view a large number of records at once.
Serial file ordering is similar to sequential file ordering, except the records are not stored in
any order. They are simply stored one after the other as they are added, similar to new items
on a to-do list. This type of ordering is often used to capture transactions as they occur during
2
the day. This is useful because it provides an easy way to go back and check a transaction.
They may be reorganized into a sequential order after they have been checked, processed or
backed up.
(EXAM TIP)
Understand the difference between sequential access and serial access.
Sequential access means accessing records one by one in the order they are stored until the right
one is reached. This type of access is used with sequential file ordering. It can be slow if there is a
lot of data to go through, but it is very effective for accessing, viewing and modifying records in
large batches.
Serial access works in the same way - the records are read one by one in the order they are stored
until the desired record is found.
Random access, or direct access, allows you to access the record you want without having to
go through any others. The computer locates the data item using the indices.
Index sequential file ordering uses both types of access to search for records. Sequential access
is used to go through each record, and direct access is used to find a specific record. For example,
Star Manufacturing keeps a file with supplier records. To be able to place an order with a
supplier, that supplier's individual record must be accessed - this requires direct access. At the end
of a financial quarter, Star Manufacturing prints out an ordered list of all supplier information so it
can do a financial review. This requires sequential access.
3
of setup would benefit from direct and sequential file ordering, so index sequential file ordering
and access is probably the best system to use.
(EXERCISE )
Read these descriptions of data sets and suggest the most appropriate choices for their file
organization and access.
1. A company distributes a list among its employees for ordering stationery items. Each item is
added as it is requested. Serial organization/access
2. A company has a set of records detailing the seating arrangement of all employees, listed in
order of seat number. Sequential organization, and access
3. A bank keeps track of the banking transactions you carry out every day and sends you a
printed statement of all transactions at the end of each month. Sequential organization,
sequential access
4. A software installation company has a list of customers that still owe the company money
for installations. Each customer's record must be accessible so their balance can be updated
when they pay another installment, and the whole list must be printed at the end of each
month so the financial manager can get an overview of the changes since the previous
month. Sequiential organization, Index sequential organization and access,
5. A student uses a flash drive to back up the projects, pictures and music files that she keeps
on her computer. Random
Gay, G and Blades, R. Information Technology for CXC CSEC, Oxford: University Press 2005.