You are on page 1of 8

File Organisation

Organise, what it means:


To form an order!
Organise, why?
So that we can get/locate (access) something efciently.
What it considers or what it means for a compter is:
!ow records are "eing organised/arranged within a #le.
!ow records are "eing accessed/searched/located in di$erent ways within
a #le.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
The & di$erent methods:
Serial
Se'ential
(irect ()andom)
*estion: what is serial, se'ential and direct, any rogh idea?
+or today we are loo,ing at sing the & methods in:
-rganising/.rranging
.ccessing//oo,ing//ocating
Storage medim (the materials on which data is stored): 0agnetic tape 1s
!ard dis, /oo, at "oth organising and accessing
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
.cti1ities:
Write ot a shopping list with 23 items in 2 minte!
Write ot a shopping list with 3 items in the categories of hosehold
electrical appliances, groceries and consma"les!
4ow e5change with yor classmate!!
.fter that, demonstrate "y sing cards also!!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
0ethods of organising #les:
Serial:
With a serial #les, the records do not follow each other in any particlar
order, so if another record needs to "e added it can 6st "e added to the
end of the #le.
Se'ential:
Se'ential #les are li,e serial #les e5cept that the records are held in a
certain se'ence (e.g. they are sorted ot in an order). +or instance, yo
might decide to order the ppil #le in admission nm"er se'ence.
(irect (random):
(irect/)andom #les ha1e to "e stored on dis, and as the name sggest,
they are not stored in any order on the dis, srface. The dis, operating
system (the program that controls the storage on the dis,) ,eeps a map of
the dis, srface and sing this map, the read/write heads can go straight
to the data. 7n this way, the data is fond withot the whole dis, ha1ing to
"e read. (irect/)andom access allows data stored on dis, to "e fond
e5tremely 'ic,ly.
-r it means that 8When a record is stored in a random access #le, its
location on the dis, (its dis, address) is calclated from its ,ey #eld.9
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
0ethods of accessing #les:
Serial:
To read a serial #le, a compter has to read each record ntil it reaches
the one re'ired.
Se'ential:
With the se'ential access, the records are in order, so if 6st one record is
re'ired then the method is slow "t if all the records are re'ired then it
is 1ery fast.
(irect (random):
With direct access #les, it is possi"le to go directly to a record withot
ha1ing to loo, at any records #rst. :o can access "oth se'ential and
random #les directly.
-r it means 8When a record needs to "e retrie1ed, the dis, dri1e can go
straight to the record re'ired withot ha1ing to read a lot of earlier
records9.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
;5ercises (7n terms of how information is organised and accessed):
Scrolls 1s <oo,s
=assette tape 1s 7>-(
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
)easons for choosing di$erent methods of access (pg.?@)
The nm"er of records to "e accessed
The siAe of the #le
Whether or not the application is interacti1e
The type of storage medim "eing sed
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
7dentify the storage medim sed in terms of methods (serial/se'ential/direct),
time to access (pg. 22&):
0agnetic tape, 0agnetic dis,, =assette tape, +loppy dis,
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
.d1antages:
Serial Se'ential (irect
(irect access o1er se'ential access
Selected records can accessed faster, it does not ha1e to go throgh all of
the records.
)ecords can "e accessed in any orderB it goes directly to the records.
)ecords can "e stored in any order; do not need to "e sorted in
se'ence.
Se'ential access o1er direct access
Se'ential #les can "e stored on magnetic tape as well as on disc, "t
direct #les can only "e stored on disc and not on tape.
7t is sally easy to write programs (design) to handle se'ential #les.
Se'ential access o1er serial access
Se'ential #les are serial #les that are 8sorted9. To perform a merging
and pdate of #les, it is easier if the serial #les are sorted and turn into
se'ential #les "ecase both key feld will then "e in the same order.
+or e5ample sing a transaction #les to pdate a master #le.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
& 0ethods
=haracteristics Serial: Se'ential: (irect ()andom):
Ways of Storage +iles are stored
one after another
..............loo, at
serial
+iles are not stored
one after another
(not in any order)
Ways of .ccess /oo, for the
records one "y
one
..............loo, at
serial
Co straight/directly
to the records
needed.
Time to access Slower Slightly +aster +astest
=ost ;asier to design,
cost less
..............loo, at
serial
!arder to design,
cost more
Storage medim 0agnetic tape 0agnetic tape
(can also "e hard
dis,)
!ard dis, only
;5ercises:
2. What is a se'ential access #le?
D. Ci1e e5ample of a medim sita"le to hold se'ential access.
&. Ci1e an e5ample of an application where a se'ential access #le wold "e
appropriate
2. What is a direct (random) access #le?
D. Ci1e e5ample of a medim sita"le to hold direct (random) access.
&. Ci1e an e5ample of an application where a direct (random) access #le
wold "e appropriate
2. What is meant "y serial access to a #le?
D. Why is it not possi"le to se direct access to a #le held on magnetic tape?
&. What form of access is "est for large #les when yo are only going to
access one or two records at a time?
2. What are the di$erences "etween serial and se'ential access #les?
D. What are the di$erences "etween serial and direct access?
2. What are the ad1antages of direct access o1er serial access?
D. What are the ad1antages of se'ential o1er serial access?
&. What are the ad1antages of serial o1er se'ential access?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ile >rocessing
When processing and updating a #le (in compter term), a few processes are
in1ol1ed: Insertions, Deletions, Amendments, Sorting and Merging.
>rocess:
Insertion is to add of new records to a #le.
Deletion is to remo1e e5isting records from a #le.
Amendment is to change the items/details within e5isting records.
Sorting is arranging items of data into certain, predetermined order.
Merging is combining two fles together.
+iles needed:
. Master fles is the most important #le since it is the most complete and
pEtoEdate 1ersion of a #le. 7t a master #le is lost or damaged and it is the
only copy, the whole system will "rea, down.
. ransa!tion fle is sed to hold temporary data which is sed to pdate
the master #le. . transaction is a piece of "siness, hence the name
transaction #le. Transactions can occr in any order, so it is necessary to
sort a transaction #le in the same order as the master #le "efore it is sed
to pdate the master #le (contains details of all records which are to "e
added, deleted or changed).
;5amples of 0aster #le:
School: Stdent +ile, Sta$ +ile.
/i"rary: <oo,s +ile
Shop: Stoc, +ile
=ar repair garage: >arts +ile
;5ercise: Thin, of transaction #le for each of the master #le a"o1e!
School:
/i"rary:
Shop:
=ar repair garage:
To pdate:
"nsort
ed
Sales
+ile
Fpdate
d Stoc,
+ile
Stoc,
+ile
Sorted
Sales
+ile
0erge/Fpda
te
Sort
The CrandfatherE+atherESon >rinciple (>g. 2D2)
There is always a slight chance that the data contained on a master #le may"e
destroyed (an operator failre, power failre, #re or theft...etc), which can "e
disastros. <t sing the 8CrandfatherE+atherESon >rinciple9, it is possi"le to
recreate the master #le if it is lost.
Transacti
on +ile
0aster
+ile
0aster
+ile
Transacti
on +ile
0aster
+ile
0erge 0erge
Son
Son
+ather
+ather Son
(0ost
recent)
Crandfathe
r
(-ldest)
*ic, Test:
2. What mst happen to a transaction #le "efore it can "e sed to pdate a
master #le?
D. What #les is prodced "y the pdating process?
&. What happens to the 8son9 master #le on the ne5t pdate?
G. What term refers to the 6oining of D #les to prodce a new #le that is in ,ey
#eld order?
3. What is 8CrandfatherE+ather theory9 and why company ses them?
@. (raw system Howcharts and e5plain the following process:
a. Sorting
". 0erging
c. Fpdating

You might also like