Consider a file of deposit records of the form:
aaaaaaaaaaaa¯type deposit = record
bname : char(22);
account# : char(10);
balance : real;
end
-
If we assume that each character occupies one byte, an integer occupies
4 bytes, and a real 8 bytes, our deposit record is 40 bytes long.
-
The simplest approach is to use the first 40 bytes for the first record,
the next 40 bytes for the second, and so on.
-
However, there are two problems with this approach.
-
It is difficult to delete a record from this structure.
-
Space occupied must somehow be deleted, or we need to mark deleted
records so that they can be ignored.
-
Unless block size is a multiple of 40, some records will cross block boundaries.
-
It would then require two block accesses to read or write such a record.