File Organisation

?
Why are files necessary?
To store data (i.e variables) permanently after the program has been stopped. They can then be opened and the data can be read and copied back to the program.
1 of 51
Describe the structure of a file. (1)
A file is a collection of related data items such as the information stored on all the students in a class. A file is split up into records A record is a collection of all the items relating to an object (e.g. a student) and is treated
2 of 51
Describe the structure of a file. (2)
as a unit during processing A record is split up into fields Each field contains a single item of data about an object (e.g. the forename of a student)
3 of 51
Define the properties of a fixed length record.
A fixed length record will have: the same number of fields in each record, the same number of bytes for each field
4 of 51
Define the properties of a variable length record.
A variable length record: may have a different number of fields in each record, will have a different number of bytes for each field, will have markers or delimiters which mark the end of each field and record
5 of 51
Advantages of a fixed length record?
(1) They are easier to program as each record is the same size and no problems with field/record delimiters (2) Easy to calculated storage space (3) Records are quicker to process as beginning and end positions of each record and field is known
6 of 51
Disadvantages of a fixed length record?
(1) They waste storage space as fields have blank space (2) They truncate fields if there is not enough storage space available
7 of 51
Advantages of a variable length record?
(1) They save storage space as there is no blank space (2) They avoid truncated fields as they expand to accommodate any number of characters
8 of 51
Disadvantages of a variable length record? (1)
(1) They are more difficult to program as you have to search for delimiters to work out where fields and records begin and end (2) They make it difficult to calculate how much storage space is required as each record is a different size
9 of 51
Disadvantages of a variable length record? (2)
They make it difficult to calculate how much storage space is required as each record is a different size
10 of 51
Define "Master file"
A master file contains all the data for all the records stored e.g. bank account details. Master files are organised sequentially
11 of 51
Define "Transaction file"
A transaction file contains the changes or updates for some of the records e.g. deposits or withdrawals. Transaction files are serial files and need to be sorted before they can be used.
12 of 51
How do you process a file? (1)
Sort the transaction file into same order as the master file (key field order) Read each transaction record in turn Find the corresponding record in the master file Update the record with the transactions Write the updated record to the new master fi
13 of 51
How do you process a file? (2)
Output required data e.g. bills, pay slips etc. Write remaining records from old master file to new
14 of 51
Key points of backups. (1)
Files need to be regularly backed up to avoid loss of data. A backup is a copy of the data which remains live on the system. A three generation backup system is typically used. This involves storing three of the most recent versions of the master and
15 of 51
Key points of backups. (2)
transaction files. If the current master file becomes corrupt it can be recreated from the back up of the old master and transaction files.
16 of 51
Key points of archiving files. (1)
When the data in a file is no longer in everyday use it needs to be archived. Archived data is taken offline. It may still need to be kept for security or legal or historical reasons
17 of 51
Key points of archiving files. (2)
It is stored securely either off-site or in a fire-proof safe etc. Archiving frees up space on the main computer system which allows faster access to in-use data.
18 of 51
How is a serial file organised?
A serial file has records stored one after the other in order of arrival
19 of 51
How do you find a record in a serial file?
To find a record you must start at the beginning of the file and look at each record in turn until you find the one you are looking for. This is very slow.
20 of 51
When are serial files used?
Serial files are only used if the file size is small or if all the records in the file need to be processed every time.
21 of 51
How do you add a record to a serial file?
To add a record to a serial file the new record is appended to the end of the file To delete a record in a serial file: all the records must be copied across to a new file until the position of the record to be deleted is found do not copy this recor
22 of 51
How do you delete a record from a serial file?
all the records must be copied across to a new file until the position of the record to be deleted is found do not copy this record to the new file copy the rest of the file to the new file
23 of 51
Advantages of serial files?
Easier to program because it uses serial read/write access Very efficient and fast when ALL the records in the file need to be processed. Minimum storage capacity required as it uses fewer overheads Very easy to add new records as they are just added
24 of 51
Disadvantages of serial files?
Very time consuming to find an individual record
25 of 51
How are sequential files organised?
A sequential file has records stored and accessed in key field order.
26 of 51
When are sequential files used?
Sequential files are used when all the records in the file need to be processed in one go
27 of 51
How do you add records to a sequential file? (1)
all the records must be copied across to a new file until the position of the record to be inserted is found the new record is then written to the new file the rest of the file is then copied to the new file If multiple records are added these should
28 of 51
How do you add records to a sequential file? (2)
be sorted first to avoid multiple updates
29 of 51
How do you delete records from a sequential file?
all the records are copied to a new file until the record to be deleted is found do not copy the record to be deleted copy the rest of the file if multiple records are to be deleted these should be sorted first to avoid multiple updates
30 of 51
What are the advantages of sequential files?
(1) Easier to program to access a record because it uses a serial search (2) Very efficient and fast when ALL the records in the file need to be processed. (3) Minimum storage capacity required as it uses fewer overheads
31 of 51
What are the disadvantages of using sequential files?
(1) Slow to find individual records (2) Complicated to add a new record to a sequential file
32 of 51
How are indexed sequential files organised?
An indexed sequential file also has records stored in key field order. It includes an index to allow data to be accessed directly.
33 of 51
What does the index in an indexed sequential file do?
The index records which record numbers are stored in which section of the file – like chapters on a DVD. Allows both sequential and direct access to the records.
34 of 51
When are indexed sequential files used?
Used when records are all processed in one go but also when individual records may need to be accessed. Such as producing bills but also dealing with individual enquiries.
35 of 51
Key points of a multilevel index? (1)
Consists of a main index which contains the range of key fields stored and the location of the next level index The next level index may also include a range of key fields and the location of the next index and so on The last index will contain the
36 of 51
Key points of a multilevel index? (2)
physical address of the record for each key field
37 of 51
Advantages of indexed sequential files?
Allows much faster access to records as the index narrows down the part of the file which needs to be searched or gives the location of the record so it can be accessed directly. Very efficient when ALL the records are processed at once (batch)
38 of 51
Disadvantages of indexed sequential files?
Index takes up extra storage space (although less storage than random files) New records have to be inserted in the correct place or in overflow areas and indexes must be updated
39 of 51
How do you find a record in a random access file?
The physical location of the record is calculated from the data in the key field A hashing algorithm is used to calculate this locationTo find a file apply the hashing algorithm to the key field and then go direct to that location to retrieve the rec
40 of 51
When are random access files used?
Used when records need to be found quickly but not all processed at once. E.g. patient records, booking systems etc.
41 of 51
How does a typical hashing algorithm work?
A typical hashing algorithm might divide the unique record ID by a prime number close to the number of records in the file and take the remainder as the storage location. The record will be stored in this memory location.
42 of 51
What is a data collision?
Sometimes the same storage location is generated for more than one record this is known as a collision.
43 of 51
How are data collisions handled?
If a collision occurs the record is inserted into an overflow area
44 of 51
How do you find a record in a random access file?
When searching for the record it uses the hashing algorithm to calculate the location and goes straight to this location; if the record is not there it does a serial search of the overflow area.
45 of 51
What is the most likely cause of slow access rates in random access files?
large overflow area when the file gets quite full
46 of 51
Why do random access files need to be reorganised?
Random files need to be reorganised periodically to improve speed of access when the overflow area becomes too large. A new hashing algorithm is used to recreate the file and can result in a larger file
47 of 51
How do you add a new record to a random access file?
apply the hashing algorithm to the key field to calculate the memory location store the record in this memory location unless it is occupied in which case add the record at the end of the overflow area
48 of 51
How do you delete a record from a random access file?
apply the hashing algorithm to the key field go to the location generated if the record is found mark it as deleted otherwise carry out a serial search of the overflow area and mark the record as deleted when found
49 of 51
Advantages of random access files?
(1) Quickest method to find individual records especially with large files (2) New records can be easily added to the file
50 of 51
Disadvantages of random access files?
(1) Takes up about twice as much storage space as a sequential file. (2) Not efficient when all the records need to be processed at once. (3) Needs reorganising periodically when the overflow area becomes too large.
51 of 51

Other cards in this set

Card 2

Front

Describe the structure of a file. (1)

Back

A file is a collection of related data items such as the information stored on all the students in a class. A file is split up into records A record is a collection of all the items relating to an object (e.g. a student) and is treated

Card 3

Front

Describe the structure of a file. (2)

Back

Preview of the front of card 3

Card 4

Front

Define the properties of a fixed length record.

Back

Preview of the front of card 4

Card 5

Front

Define the properties of a variable length record.

Back

Preview of the front of card 5
View more cards

Comments

Bananaexcel 2.0

Report

The person who made this must have been like super cool and super smart when it comes to files and computing science

FaviolaSHanson

Report

Guest users should have access to delete their own records using their IP address. I am using this platform and I think it should be done by the guest side. Today I was searching for a translation service and I got the https://pickwriters.com/japanese-translation-services link and it is the best platform to translate the Japanese language. So during this searching, I read your post and shared my views with you.

Similar Computing resources:

See all Computing resources »See all Data structures resources »