You are on page 1of 17

File organization

and
access methods
Objectives
Students should be able to :
Describe various methods of file organization and access
Select appropriate file organization for particular application.
Definitions
Record- Is a collection of related data items (possibly of different types) stored in fields and : treated
as a single entity for processing.
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.
Data file - Is a collection of records holding the same types of information but about different
objects or individuals.
Important characteristics of a file
A file can be regarded has either a permanent or temporary

The organization of the file

The way in which the records of a file are accessed.


Types of File
Many businesses and organizations regularly access, modify and store large amounts of files. These files
are given special names to identify their purpose.

Master File
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.
Types of File Cont’d

Transaction File
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 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.
Types of File Cont’d
Transaction log
Also known has the change file.
This file keeps a record of changes made to the transaction file. This
is important, as many businesses need to record the history of
what transactions have taken place.
File Organization (methods)
Files and records need to be organized so they are easily accessible and easy to
update when necessary. A database is an organized collection of data.

Sequential File ordering

Random File ordering

Index sequential file ordering


Sequential File ordering
Records
o are stored in a logical order.
o 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.
Random File ordering
aka “ Direct access file ordering”

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.
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.
Index sequential file ordering

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 cont’d
E.g - 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.
File Access (methods)
Sequential Access

Direct Access (aka Random access)


Sequential Access
The accessing of 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.

E.g 1- 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.
Sequential Access cont’d
E.g 2- . 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 of setup would benefit from direct
and sequential file ordering, so index sequential file ordering and
access is probably the best system to use.
Direct Access (aka Random 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.

 it allows equally easy and fast access to any randomly selected destination.
E.g - of storage devices that use direct access are:
◦ hard disks
◦ CDs
◦ USB flash drives
◦ DVDs
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.
2. A company has a set of records detailing the seating arrangement of all employees, listed in order of
seat number.

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.
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.

5. A student uses a flash drive to back up the projects, pictures and music files that she keeps on her
computer.

You might also like