Mongolia International University
Storage and Storage and MultimediaMultimedia
Chapter 6Chapter 6
B.M.HB.M.H
MIUComputers
IndexIndex
How data is organized How data is organized How to access the fileHow to access the file
File organizationFile organization Sequential file organization Direct file organization Indexed file organization
How to process the fileHow to process the file Batch processingBatch processing Transaction processingTransaction processing
MIUComputers
How data is organizedHow data is organized
Raw data is organized intoRaw data is organized into Characters Characters FieldsFields RecordsRecords File File DatabasesDatabases
MIUComputers
How data is organizedHow data is organized
Characters Characters the smallest elementthe smallest element A letter, digit, or special characterA letter, digit, or special character
FieldsFields A set of related charactersA set of related characters
RecordsRecords A collection of related fieldsA collection of related fields
MIUComputers
How data is organizedHow data is organized
File File A collection of related recordsA collection of related records
DatabasesDatabases A collection of interrelated files stored A collection of interrelated files stored
together with minimum redundancytogether with minimum redundancy
MIUComputers
How data is organizedHow data is organized
KeyKey A field of particular interestA field of particular interest A unique identifier for a recordA unique identifier for a record
Ex. custom number, product number, social Ex. custom number, product number, social security number, security number,
MIUComputers
The File PlanThe File Plan
The plan considered by some The plan considered by some computer professionalcomputer professional How to access the fileHow to access the file
File organization How to process the fileHow to process the file
Mongolia International University
How to access the fileHow to access the file
MIUComputers
File organizationFile organization
Three major methods of organizing data Three major methods of organizing data files in secondary storagefiles in secondary storage SequentialSequential file organization file organization DirectDirect file organization file organization IndexedIndexed file organization file organization
MIUComputers
Sequential File Sequential File OrganizationOrganization
Records are arranged sequentiallyRecords are arranged sequentially stored in order according to a key fieldstored in order according to a key field
To find a particular record To find a particular record All the prior records in the file must be readAll the prior records in the file must be read before before
the desired record is reachedthe desired record is reached
MIUComputers
Direct File OrganizationDirect File Organization
RandomRandom file organization file organization Allows direct (random) accessAllows direct (random) access
The ability to go directly to the desired The ability to go directly to the desired record record by using a record keyby using a record key
The benefit The benefit the ability to read, change, and return a the ability to read, change, and return a
record to its same place on the diskrecord to its same place on the disk called called updating in placeupdating in place
MIUComputers
Direct File OrganizationDirect File Organization
To find the record on a diskTo find the record on a disk Used a certain formula to apply to the Used a certain formula to apply to the
record keyrecord key Deriving a number to use as the disk address
Hashing, or randomizing algorithmHashing, or randomizing algorithm The mathematical operation that is applied to a key to
yield a number that represents the address
MIUComputers
Simple Hashing SchemesSimple Hashing Schemes
A general idea of how the process worksA general idea of how the process works
MIUComputers
MIUComputers
Hashing AlgorithmHashing Algorithm
CollisionCollision For a hashing algorithm to produce the For a hashing algorithm to produce the
same disk address (called synonym) for two same disk address (called synonym) for two different recordsdifferent records
Even though the record keys are unique
To recover from a collisionTo recover from a collision One way : to use One way : to use the next available record the next available record
slotslot in the disk in the disk fig 6-13 fig 6-13
MIUComputers
Indexed File OrganizationIndexed File Organization
A compromise between the A compromise between the sequentialsequential and and direct methodsdirect methods RecordsRecords are stored are stored in sequentialin sequential order order The fileThe file also contains also contains an indexan index
The index contain The record key The address associated with the key
MIUComputers
Storage mediaStorage media
Tape storageTape storage Limited to Limited to sequentialsequential file organization file organization
Disk storage Disk storage May be May be sequentialsequential, and also accessed , and also accessed
directlydirectly a direct-access storage device (DASD)a direct-access storage device (DASD)
The computer can go directly to the desired record on the disk
Mongolia International University
How to process the fileHow to process the file
MIUComputers
Processing stored dataProcessing stored data
Most business file processingMost business file processing involves processing involves processing transactionstransactions to update to update
a a master filemaster file TransactionTransaction : a business event that required : a business event that required
the business’s records to be updatedthe business’s records to be updatedEx. a retail sale, the receipt of ordered goods
Master fileMaster file : contains data that must be : contains data that must be updated as transactions occurupdated as transactions occurEx. an inventory file, an employee file, a customer file
MIUComputers
Processing stored dataProcessing stored data
Two main methods Two main methods Batch processingBatch processing Transaction processingTransaction processing
MIUComputers
Batch processingBatch processing
A technique of processing transaction A technique of processing transaction data data in groupsin groups at a more convenient at a more convenient later timelater time Transactions are collected into batchesTransactions are collected into batches to be processed at a time to be processed at a time
when the computer may have few online users and thus be more accessible, often during the night
No direct user interactionNo direct user interaction
Ex. web page club’s member fileEx. web page club’s member file
MIUComputers
Batch processingBatch processing
Transaction fileTransaction file Contains all changes to be made to the Contains all changes to be made to the
master file: additions, deletions, and master file: additions, deletions, and revisionsrevisions
Master fileMaster file Periodically updated with the changes Periodically updated with the changes
called for in the transaction filecalled for in the transaction file
MIUComputers
Batch processingBatch processing
1.1. Changes are stored in transaction filesChanges are stored in transaction files
2.2. Transaction file is sorted by a key fieldTransaction file is sorted by a key field All the transactions are in sequential orderAll the transactions are in sequential order
Ex. By the member number of the webpage Ex. By the member number of the webpage clubclub
3.3. Matching the keys from the mater file Matching the keys from the mater file and transaction filesand transaction files
Records of mater file already are in orderRecords of mater file already are in order
4.4. CPU processes the appropriate actionCPU processes the appropriate action
5.5. A newly updated master file is createdA newly updated master file is created
MIUComputers
MIUComputers
Batch processingBatch processing
AdvantageAdvantage EfficiencyEfficiency
DisadvantageDisadvantage The master file is current only immediately The master file is current only immediately
after processingafter processing
MIUComputers
Transaction processingTransaction processing
A technique of processing transactions A technique of processing transactions immediately, as they occur immediately, as they occur Each transaction is handled immediatelyEach transaction is handled immediately Real-time processingReal-time processing
A transaction is processed fast enough for the result to come back and be acted upon right away
Online : Online : the terminals must be connected directly to the
computer
Ex. bank withdrawal, flight reservationEx. bank withdrawal, flight reservation
MIUComputers
Transaction processingTransaction processing
Use disk storage Use disk storage For direct access to the desired recordFor direct access to the desired record
Advantage Advantage Immediate accessImmediate access to stored data to stored data Immediate updatingImmediate updating of the stored data of the stored data
MIUComputers
MIUComputers
Batch & Transaction Batch & Transaction ProcessingProcessing
Numerous computer system Numerous computer system combine the best features of both methods combine the best features of both methods
of processingof processing Transaction processing : used for activities related to the
current needs of people Batch processing : done at any time, even in the middle
of the night
MIUComputers
Batch & Transaction Batch & Transaction ProcessingProcessing
Ex. Store systemEx. Store system Updating the individual item’s inventoryUpdating the individual item’s inventory
Needed transaction processing Producing daily and weekly sales report Producing daily and weekly sales report
Used batch processing