the fun that is file structures

12
The Fun That Is File Structures Pages 256-261 By: Christine Zeitschel

Upload: grace-wong

Post on 31-Dec-2015

31 views

Category:

Documents


1 download

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 Presentation

TRANSCRIPT

Page 1: The Fun That Is File Structures

The Fun That Is File Structures

Pages 256-261By: Christine Zeitschel

Page 2: The Fun That Is File Structures

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.

Page 3: The Fun That Is File Structures

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.

Page 4: The Fun That Is File Structures

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

Page 5: The Fun That Is File Structures

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.

Page 6: The Fun That Is File Structures

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.

Page 7: The Fun That Is File Structures

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.

Page 8: The Fun That Is File Structures

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

Page 9: The Fun That Is File Structures

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

Page 10: The Fun That Is File Structures

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.

Page 11: The Fun That Is File Structures

Index File

KEY35423543354435453546

ADDRESSJames DeanMarilyn MonroeJohn KennedyBob DoleRobert Kennedy

Page 12: The Fun That Is File Structures

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.