| Fixed Length Fields | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
A fixed length field is one which contains a set number of characters. With fixed length fields, the fields may need to be padded out to the right length, eg with <space> characters. eg If a Surname field is set at 10 characters then the name SIMPSON would need 3 <Space>s added on to the end of it. Advantage - Every record is the same size, so it is possible for the computer to calculate exactly where each record starts in the file and therefore it is quicker for the computer to find a particular record. Example 1 Each record of this file has 4 fields.
The field sizes may be fixed at ...
The first three records of the file would therefore be stored as in the following table (each square represents one byte):
Each record takes up 26 bytes of storage space. The first three records of the file take up 78 bytes of storage.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Exercise : Fixed Length fields | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| If fixed length fields are used, each field
size . The fields may need to be padded out with extra characters.
Advantages : Disadvantage :
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (Green indicates success) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||