Table 6–1 (Cont.) Compaq COBOL File Organizations—Advantages and Disadvantages
File
Organizations
Advantages
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
Compatible with text editors
Relative
Allows sequential, random, and
dynamic access
Provides random record deletion
and insertion
Allows READ/WRITE sharing
Indexed
Allows sequential, random, and
dynamic access
Allows random record deletion
and insertion on the basis of a
user-supplied key
Allows READ/WRITE sharing
Allows variable-length records to
change length on update
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
1
Beginning of file
RECORD
RECORD
2
Processing Files and Records
6.1 Defining Files and Records
Disadvantages
Allows sequential access only
Used for printable characters only
Open Mode I/O is not allowed
Allows data to be stored on disk only
Requires that record cells be the same size
Allows data to be stored on disk only
Requires more disk space
Uses more memory to process records
Generally requires multiple disk accesses to
randomly process a record
End of file
RECORD
...
3
(n−1)
Processing Files and Records 6–3
RECORD
n
ZK−6055−GE