Vous êtes sur la page 1sur 5

Files Terminology

CS 102
File – a collection of related data
File Structures &  examples : student records, payroll file
File Organizations Entity – a data item of interest
 example : student or employee
Fields or Columns – data related to an entity or
Chapter 01 object
Introduction to File Organizations  examples : last name, first name, gender, birth
date, (degree program or department), (year
level or job title), etc.

CJD

Files Terminology Why External Storage ?

Record or Row – a grouped collection of fields  collection of data usually too large to fit in main
about an entity or object memory
 examples: fields about a student or employee  only a small portion of the file is accessed at a
Key – one or more fields chosen to identify a time need to be in internal memory
record uniquely. Files are usually ordered  file needs to be stored permanently in non-
according to key values. volatile storage for access by several programs
 examples: student or employee number, or last
name, first name and birth date.
Preference : Contiguous storage of data
provides quicker access to information.
CJD CJD

Our Objective Factors of File Design

Objective :  File Organization – how records are stored


Investigate structures used to organize large  File Type – role of the file in an information
collections of data into files stored on secondary system
storage devices.  File Characteristics – activity and volatility of
the file
File Design goals :  File Manipulations – operations to access the
file and keep it current
Efficiency of storage and access.
Many factors affect file design.

CJD CJD

1
File Organizations Sequential File Organization
 the way in which records are stored in an  Records are stored and accessed consecutively
external file. in sequence from beginning to end
 the data structures used for organizing the data  Records are usually in ascending or descending
order by the key field

Common File Organizations  On average, half the records must be accessed


to locate a record of interest
1. Sequential
 The entire file must usually be copied in order to
2. Random update it
3. Indexed Sequential  Records may be fixed length or of varying length
4. Multikey

CJD CJD

Random File Organization Relative Files


 Allows access of a record without sequential  an implementation of random file organization
search through the file with fixed record lengths.
 There is a relationship between each record’s  Each record in secondary storage is assigned a
key and its location in an external file record number which designates its relative
 Directly computes the location of the record position with respect to the beginning of the file.
using key value
 There may be no relationship between the logical
ordering and the physical ordering of the file.

CJD CJD

Relative Files Indexed Sequential File Organization


 The first record may be record number 0 or 1  a hybrid of sequential and random file
depending on implementation. organizations

 record address =  Records may be variable length.

address of beginning of file +  Records are grouped into blocks.

relative record number x fixed record length  Blocks are fixed length.

 can be updated in place  Records in a block are not necessarily ordered


but usually are.
 can be sequentially accessed according to
physical order of records in storage but this  Each block is stored in a contiguous location.
access is usually meaningless.  The blocks are organized into a relative file
ordered by the key fields of representative
records per block.
CJD CJD

2
Indexes Indexes
 there is a hierarchical structure of record keys  index can specify order in which file should be
and relative block numbers called an index accessed sequentially by record keys.
 To retrieve a record,  access speed is almost as fast as random file
index is used to retrieve the relative record organization but slower due to the index search
number of the block containing the record,
then the relative file of blocks is accessed
randomly
then the block is searched sequentially for the
record

CJD CJD

Multikey File Organization File Types


 allows multiple ways to access the file by several Six File Types according to functionality :
different key fields
 uses indexing structure with indexes for each key 1. Master File - records of permanent data but
field are updated occasionally
 major collection of data pertaining to a specific
application
 usually stored on disks, and nowadays rarely on
tape
 Example : Bank accounts file, accounts balances
file

CJD CJD

File Types File Types


2. Transaction File – records of operations 4. Report File – information prepared for the
applied to master file user. May be printed or displayed on-screen.
 Example : new account opening file,  Example : Summary of accounts, Error and Audit
Deposits/Withdrawals file listings of a maintenance run
3. Table File – records used for lookup 5. Control File – summary of maintenance run
 Example : Interest rates file, minimum balance  Example contents : run date, maintenance
requirement file, account type description file statistics
6. History File – backup of master, transaction
and control files from past runs.

CJD CJD

3
File Characteristics File Characteristics
Usage characteristics of a file :  volatility – number of records added and
 file size – consider initial and future file sizes to deleted compared to original number of records.
determine storage that can accommodate file. high volatility – best updated using merge
 activity – percentage of master records updated procedures. Non-sequential files have high
during a maintenance run overhead to reorganize as a result of these
updates.
high activitity is more efficiently stored using
sequential file organization  frequency of use – sequential files require more
time to update on hourly basis instead of daily or
low activity is more efficiently stored using monthly basis, so can’t be used frequently
organizations with random access that allows
update in place  required response time – real time access
require random access
CJD CJD

File Manipulations : Queries File Manipulations : Merging


1. Queries 2. Merging
 searching records whose values meet a criteria  combining data extracted from two or more files
 the types of queries to be performed can affect file  Examples :
design
File of Engineering students is usually
 Examples : separate from file of grades
List the record of student Juan De La Cruz Counting all Engineering students per major
List all students enrolled in more than 20 units with an average of 1.5 or better requires
merging these files.
List all second-year level Engineering students
Count all Engineering students per major with
an average of 1.5 or better
CJD CJD

File Manipulations : Maintenance File Manipulations : Maintenance


3. Maintenance  file maintenance program merges transaction and
master files
 updating master file with transaction file to keep
the master file up-to-date if transaction refer to a non-existent master file
record, it must be an addition transaction
 possible transaction or update codes could be
if transaction refer to an existent master file
A = addition of a new master file record record, it must be an update or deletion
C = changing values of fields of master file if no transactions refer to a master file record,
records no update on that record is made
D = deletion of an existing record from master  For sequential files, transactions must be ordered
file in the same key sequence as the master file so
they may be merged. A new master file is created
by the maintenance program.
CJD CJD

4
File Manipulations : Multifile File Manipulations : Multifile
4. Multifile Information Systems 4. Multifile Information Systems : DBMS
 uses many master files Database management systems (DBMS) is a
 designed to reduce duplication of information multifile information system

 Examples : DBMS is out of scope of this course and is the


subject of a different course.
The last name and first name need not be
stored with each grade of a student.
Only the key field “student number” is in both
student file and grades file to link
corresponding records.

CJD CJD

End

CJD

Vous aimerez peut-être aussi