A file can contain:
Using variable-length records might enable you to save disk space. When you use fixed-length records, you need to make the record length equal to the length of the longest record. If your application generates many short records with occasional long ones, using fixed-length records wastes a lot of disk space, so variable-length records would be a better choice.
A file where all the records are of the same length is said to have fixed length records.
Advantage : Access is fast because the computer knows where each record starts. Eg If each record is 120 bytes long then the 1st record starts at [Start of File] + 0 bytes the 2nd record starts at [Start of File] + 120 bytes the 3rd record starts at [Start of File] + 240 bytes etc.....
Disadvantage : Using Fixed length records, the records are usually larger and therefore need more storage space and are slower to transfer (load or save). One or more of the fields can be of differing lengths in each record, called variable length records.
Advantages: The records will be smaller and will need less storage space the records will load faster.
Disadvantages: The computer will be unable to determine where each record starts so processing the records will be slower.
Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!