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 variable-length record?
Using variable-length records usually enables you to save disk space.
What is a serial file?
A transaction file
e.g. recording sales in a shop “clocking in”
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 an advantage of a serial file?
Adding records is very straightforward and fast
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?
Records are stored in key field order in the file
The index allows the data to be accessed directly
What is overflow?
If there is not enough space in the block where the record should be written, then this is known as an ‘overflow’.
How do we deal with overflow?
There are a number of blocks set aside in an indexed sequential file known as the “overflow area”.
When an overflow occurs:
- the record is written into the overflow area
- a pointer is left in the block where it was supposed to be stored
- to indicate in which block in the overflow area it can be found
What are the problems associated with overflow?
The more records added to the overflow, the time taken to search for records increases
This is because:
- The index is searched which indicates the block where the record should be
- The block is located (requiring disk read/write heads to move)
- If there is a tag/pointer, it now needs to find the lock in the overflow area. Adding an extra step.