the fun that is file structures
DESCRIPTION
The Fun That Is File Structures. Pages 256-261 By: Christine Zeitschel. File Structure Basics:. A file is a collection of related information into a unit whose primary purpose is to store data. Files are stored in auxiliary or secondary storage devices. - PowerPoint PPT PresentationTRANSCRIPT
The Fun That Is File Structures
Pages 256-261By: Christine Zeitschel
File Structure Basics:
• A file is a collection of related information into a unit whose primary purpose is to store data.
• Files are stored in auxiliary or secondary storage devices.
• Files store data in a more permanent form than primary memory.
FILES- Secondary storage devices
• Two most common forms- disk & tape
• These files can be both read and written
• Therefore- A file is a group of data with records of more than one field.
Access Methods
• Determine how records are retrieved, in an order or randomly.
• Use a sequential file to obtain data one record after another
• Use random access to pick one specific file.
• Two types include: indexed & hashed files
Sequential Files• A file which
records can only be selected one after another, in other words it’s like reading every page of a book to find one quote, but instead that quote is record for a computer.
More sequential files• The only thing known by the operating
system for sequential files is that records come one after another and that the end-of file (EOF) is the end marker for records.
Processing Sequential Files• Sequential access is more effective
when a person needs to retrieve each record like a paycheck at the end of the month for printing.
• This method would not work as well for a school trying to find one persons record and going through everyone’s record to get to yours.
• Updating becomes difficult as each file must be checked in order for updates.
Four Types of Files for Updating• New Master file- has most current data• Old Master file- permanent file which
needs updating• Transaction file- has changes which are
needed to be made to the master file, where you can add, delete or change transactions—a key is need like an individual ID for a field to process transactions
• Error Report file- contains a list of all errors during update process
A Deeper Look at Keys- all files must have the same keys
1) If trans key is less than master file key, add them
2) If equal either change the master file with a revision (R) or delete (D)
3) If trans key is greater put old master file key as new master file key, or add (A) new code
Indexed Files• A file made up of a data
file, with only 2 fields- the key and the address
• Index files act just as an index would for a history book, they allow you to do a search for a subject like WWI, but instead using binary and then they take you to that file.
Index File
KEY35423543354435453546
ADDRESSJames DeanMarilyn MonroeJohn KennedyBob DoleRobert Kennedy
Hashed Files
• Uses a function to map files
• The user provides a key the function maps the key to the address and then to the operating system to be retrieved
KEY- Address = Hash Function (Key) Address
The work of an index is eliminated by the use of a function to do the work.