Processing Files and Records
6.1 Defining Files and Records
Table 6–1 (Cont.) Compaq COBOL File Organizations—Advantages and Disadvantages
File
Organizations
Advantages
Disadvantages
Provides the most flexible record
format
Allows READ/WRITE sharing
Allows data to be stored on
many types of media, in a
device-independent manner
Allows easy file extension
Line Sequential
Most efficient storage format
Allows sequential access only
Compatible with text editors
Used for printable characters only
Open Mode I/O is not allowed
Relative
Allows sequential, random, and
dynamic access
Allows data to be stored on disk only
Provides random record deletion
and insertion
Requires that record cells be the same size
Allows READ/WRITE sharing
Indexed
Allows sequential, random, and
dynamic access
Allows data to be stored on disk only
Allows random record deletion
and insertion on the basis of a
user-supplied key
Requires more disk space
Allows READ/WRITE sharing
Uses more memory to process records
Allows variable-length records to
change length on update
Generally requires multiple disk accesses to
randomly process a record
Allows easy file extension
Sequential File Organization
Sequential input/output, in which records are written and read in sequence, is
the simplest and most common form of I/O. It can be performed on all I/O devices,
including magnetic tape, disk, terminals, and line printers.
Sequential files consist of records that are arranged in the order in which they
were written to the file. Figure 6–1 illustrates sequential file organization.
Figure 6–1 Sequential File Organization
RECORD
3
End of file
RECORD
(n−1)
...
ZK−6055−GE
RECORD
1
RECORD
2
Beginning of file
RECORD
n
Processing Files and Records 6–3