Processing Files and Records
6.1 Defining Files and Records
A record is a group of related data elements. The space a record needs on
a physical device depends on the file organization, the record format, and the
number of bytes the record contains.
File organization is described in Section 6.1.1. Record format is described in
Section 6.1.2.
6.1.1 File Organization
Compaq COBOL supports the following four types of file organization:
•
SEQUENTIAL—This organization requires that records be referenced in
sequence from the first record to the last. This organization is useful for
programs that normally access each record serially. (See the Sequential File
Organization section in this chapter.)
•
LINE SEQUENTIAL— This organization is essentially the same as
sequential. Line sequential allows you to treat files as collections of variable
length records, with each record containing one line of printable characters.
This organization is useful for programs that access files created by text
editors and similar programs. (See the Line Sequential File Organization
section in this chapter.)
•
RELATIVE—This organization lets you access records randomly, or
sequentially by record number values. While this organization is more flexible
than sequential organization, it is less flexible than indexed organization
because you cannot insert a record in the middle of your file unless you have
an empty cell to contain it. (See the Relative File Organization section in this
chapter.)
•
INDEXED—This organization lets you access records randomly or
sequentially, by primary and alternate key values. This is a useful way
to organize a file in which records will be added, changed, or deleted upon
demand. (See the Indexed File Organization section in this chapter.)
Note
On Tru64 UNIX, a third-party product is required for INDEXED runtime
support. See the Read Before Installing . . . letter for up-to-date details
on how to obtain the INDEXED runtime support.
♦
Table 6–1 summarizes the advantages and disadvantages of these file
organizations.
Table 6–1 Compaq COBOL File Organizations—Advantages and Disadvantages
File
Organizations
Advantages
Disadvantages
Sequential
Uses disk and memory efficiently
Allows sequential access only
Provides optimal usage if the
application accesses all records
sequentially on each run
Allows records to be added only to the end of a file
(continued on next page)
6–2 Processing Files and Records
Содержание COBOL AAQ2G1FTK
Страница 22: ......
Страница 30: ......
Страница 94: ......
Страница 110: ......
Страница 146: ......
Страница 180: ......
Страница 194: ...Processing Files and Records 6 1 Defi...
Страница 300: ......
Страница 490: ......
Страница 516: ......
Страница 517: ......
Страница 530: ......
Страница 534: ......
Страница 590: ......
Страница 620: ......