Organisation and Structure of Data Flashcards
What does the MOD function do?
the MOD function returns the remainder
e.g. 10 MOD 3 = 1 (3+3=9, remainder 1)
What does the DIV function do?
the DIV function returns the amount of times one number goes into another
e.g. 10 DIV 3 = 3
What is a transaction file and what does it do?
A transaction file is a temporary file.
It collects data over a short period of time (e.g. a month). At the end of the timescale, the data from the transaction file is copied to the master file, often using batch processing.
What is a master file?
at the end of a transaction files timescale, the data from it is copied over to the master file (batch processing)
Master files will store all of the data required to perform batch processing operations such as generating bills etc.
What happens to both a master and transaction file before performing the update?
The transaction file will be sorted in the same primary key order as the master file
This is to speed up the update as both files only have to be read through once to perform the update
What are fixed length records?
Where all records are exactly the same length
When using fixed-length records, you need to make the record length equal to the length of the longest possible record.
What is an advantage of a fixed-length record?
They are faster to process since the exact position of the record is known.
This is because all records are the same length, therefore you are able to jump to the desired record.
What are Variable-Length records?
Where the length of each record varies according to the data it holds.
What is an advantage of variable-length records?
Using variable-length records usually enables you to save disk space.
What is a serial file?
A serial file is where records are stored one after the other, in no particular order (records are added to the end of a file)
Can be used with either tape or disk storage
What is the main use of a serial file?
A transaction file
e.g. recording sales in a shop “clocking in”
What is an advantage of a serial file?
Adding records is very straightforward and fast
What are the disadvantages of a serial file?
Very slow to search
This is because as the records are stored one after the other in no order there is no choice there is no other option other than to search one-by-one to find an item. This is a serial search.
What is a sequential file?
A sequential file had records stored one after the other in order of a key field (e.g. employee ID)
can be used with either tape of disk storage
What is a sequential file often used as?
A sequential file is often used as a master file to allow records to be searched via key field.
What are the advantages of a sequential file?
If performing a batch update, it can be quicker to perform the update if the master file and also the file being updated from are in sequential order.
When searching for a record that doesn’t exist, it will be quicker to spot that it isn’t there.
Easier to program than methods such as indexed sequential.
What is the disadvantage of a sequential file?
Can be slow to add records as they need to be added in the correct place
What is the process of adding a record to a serial file?
You open the file
Record is added to the end of the file
You close the file
What is the process of adding records to a sequential file?
- First, a new file is created
- Each record is copied from the old file to the new file until a record with primary key greater than the new record being added is found;
- The new record is being added to the file;
- All the remaining records are copied over to the new file.
(lesson 2 slide 8 for diagram)
What is the process of deleting a record from a serial or sequential file?
- A new file is created
- Every record is copied from the old file to the new file apart from the record(s) to be deleted
(lesson 2 slide 9 for diagram)
What is a block?
A block is where a track and a sector intersect.
A computer reads and writes blocks of data at a time, it is the smallest unit of transfer.
What does a disk contain?
thousands of concentric circles called tracks and a number of sectors.
What does a block contain?
each disk block could hold several records
What is an indexed sequential file?
An indexed sequential file is a sequential file so therefore has all advantages associated:
-able to update quickly when modifying large numbers of records in key field order.
However it also contains an index file:
-allows records to be directly searched for very quickly without having to read through all other records in the list.
(similar to a book which can be read through but has an index to skip to the desired page)
considered the ‘jack of all trades’, having the properties of a sequential file but also allowing very quick direct access via the index to go straight to the record. However it is not as fast as Random (Direct) Access files.
Indexed sequential files will not work on tape storage as there is no way to directly go to a record without reading through all the previous records.
The indexes are set up so that each block will only be partially filled with records so that there is room for new records to be added in future.