[計算機概論]課程參與

A file is a collection of related data records treated as a unit.
Files are stored in what are known as auxiliary or secondary storage devices.
The two most common forms of secondary storage are disk and tape.
A record in a file can be accessed sequentially(連續地) or randomly.

Sequential(連續的) file: A file whose contents can only be read in order
– Reader must be able to detect end-of-file (EOF)
– Data can be stored in logical records, sorted by a key field
• Greatly increases the speed of batch updates
– In sequential access, each record must be accessed sequentially, one after the other, from beginning to end.
– The update of a sequential file requires a new master file. An old master file, a transaction file, and an error report file.

Random Access
In random access, a record can be accessed without having to retrieve any records before it.
The address of the record must be known.
For random access of a record, an indexed file, consisting of a data file and an index, can be used.
In random file access, the index maps a key to an address, which is then used to retrieve the record from the data file.