Structure of Sequential Files

Structure of Sequential Files thumbnail
The most common computer files have a sequential organization.

A sequential file is one from which the computer reads one record after another, starting at the beginning and finishing at the end. Sequential computer files, unlike direct or indexed files, can have non-repeating structures: Different records in the same file can have different layouts. Their records may all have the same length or different lengths, the data can be predictable or extremely varied.

  1. Fixed Length

    • Some sequential files consist of a series of records, each having the same length. A file might have records, for example, beginning with a six-digit code followed by a thirty-character name for a total of 36 characters. A file of 1,000 36-character records has a total size of 36K bytes. Programs that export data, such as spreadsheets, often create fixed-length sequential files. Fixed-length sequential files may have a character, such as an ASCII carriage return, that marks the ends of records.

    Variable Length

    • A variable-length sequential file is much like a fixed-length file: it consists of records made of the same number of individual data fields, but the fields have varying lengths. In this case, the file has a separator character, such as a comma or space, that marks the end of one field and the beginning of the next. This is necessary, as otherwise a program reading the file has no consistent way of distinguishing data fields. The file also has a character that separates one record from another, as with fixed-length files.

    Documents

    • A document file, such as a spreadsheet, memo or presentation, is also a sequential file. The application creating the file writes a variety of data into the document, including blocks of text, numbers and graphics. The file format may be proprietary or openly available. Because of the variety of data in document files, they have variable length formats. The document may have an area at the beginning of the file called a header. The header contains information about the document, such as the names of the author and organization, version numbers and revision dates. A word-processing document has paragraphs of text separated by data that define fonts and tab layouts.

    Programs

    • Application programs, such as word processors, Web browsers and games, are themselves stored as sequential data files. The operating system, such as Windows, Mac OSX or Linux, reads the program file when you click an icon or type a command. The operating system decodes the file, loads it and executes the instructions it contains. An .exe file, for example, begins with a header area describing the program’s organization in memory. A set of tables follow the header, further defining program parameters. Program blocks, called segments, follow the tables. If a problem exists in the file’s organization, the operating system displays an error message if you try to run it; otherwise, it executes the program.

Related Searches:

References

  • Photo Credit Thinkstock Images/Comstock/Getty Images

Comments

Related Ads

Featured