You are on page 1of 4

File organization and access methods

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.

A file has three important characteristics:

1. Whether it is a permanent or a temporary file.

2. The way in which the records of the file are organized on the secondary storage device. This is
called file organization.

3. The way in which records are accessed (or located).

Master and transaction files


Many businesses and organizations regularly access, modify and store large amounts of files. These files
are given special names to identify their purpose. A master file is a permanent file which is kept-up-to-
date and stores the main information, summary data and key fields in the data.

The master file contains two types of data:


 permanent data, such as employee personal data ,payroll data employee status and job title

 Less permanent data, which is updated on a


regular basis, such as hours worked and taxes
deducted.

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:

 Add: put a new record into the master file.


 Update: change the contents of a record or a field
that already exists.
 Delete: remove a record from the master file.

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.

File organization and access


Files and records need to be organized so they are easily accessible and easy to update
when necessary. People and organizations capture and store a lot of data. A database is an
organized collection of data. Star Manufacturing is a large company that uses a database to
keep data about all aspects of the business. The database has several components:

 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

Figure 17.3 The structure of a database

File organization and access methods Sequential and serial

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.

ordering – how data is stored


access – how data is retrieved

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 file ordering and access


Random file ordering, also known as direct access file ordering, is where files are stored in any
order. The computer maps where all this data is stored so you can immediately access it when
you search for it. Think of a one-dimensional array where each array element has an index
number to mark its location. Random file ordering works in the same way, except the records are
organized in random order. This type of file ordering is useful if you want fast access to records,
or if you want to store data that is unrelated or does not need to be in any particular sequence.

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 and access


Index sequential file ordering uses an indexed file to store records. In other words, records are
stored in this file in sequential order and a set of indices are used to refer to each item stored in the
file. Each record can be accessed via its index number. This file ordering is a combination of
sequential and random file ordering and is used when records need to be sorted in sequence but
individual records must be quickly accessible.

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.

Using methods of ordering and access


The way that records are stored and accessed depends on the types of record, what they are used
for and even the form of storage. For example, a bank may store data about its daily transactions
using magnetic tape, which stores data using sequential file ordering. Therefore sequential
access is used to access those records. A school will have a record for each student, stored on a
file. Each student's record must be accessible to review or update information, but all records
must be printed out at the end of each school year to allocate students to new classes. This type

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.

Thornes, N Information Technology for CSEC

You might also like