- A computer program makes a sequential file simply by writing data records, one after the other, into a newly created file area. The records may all have the same length, or lengths may vary. If they vary, each record ends with a special character or characters; when a program subsequently reads the file, it uses the characters to determine where one record ends and the next begins. Programs read sequential files the same way they were created: beginning with the first record and continuing, in ascending order, to the end.
- Compared to direct-access files, programs process sequential access files faster. Programs read direct-access file records in any order, but that flexibility comes at the price of slower performance. The positioning mechanism of the computer’s hard drive works much less for sequential files than direct files, and the computer’s central processing unit (CPU) likewise has less work with a sequential file.
- Sequential files are easy to read because of their simple organization. It is a simple matter to write new programs to read existing sequential files, since the program reads the records as a simple series until it encounters an end-of-file (EOF) mark. Though the file may have nearly any content, from digitally recorded music to the text of a novel, the file’s structure has no surprises.
- Programs which share data use the sequential access file format as a “common language.” For example, a database program may export a file for a spreadsheet. The database system’s native files are very sophisticated; the spreadsheet program cannot access them directly. However, it easily reads the database’s sequential export file, especially if the database user chooses comma- or tab-delimited formats. Because of the ease of sharing data, many major applications have import and export functions using sequential files.