COBOL Manual for TNS and TNS/R Programs
Tape Input and Output
HP COBOL Manual for TNS and TNS/R Programs—522555-006
27-2
Saving Tape and Time
Saving Tape and Time
You can save both tape and time by blocking tape file records efficiently—that is, by
specifying that each physical record is to contain more than one logical record (the
default is one logical record per physical record).
Because consecutive physical records are separated by an interrecord gap, longer
physical records mean fewer interrecord gaps (less wasted tape). Because the tape
drive must start and stop each time you read or write a physical record, having fewer
interrecord gaps save time.
Interrecord gap size depends on tape drive model, but the typical interrecord gap is
about 0.6 inch (1.5 cm). If you are writing 1,600 bytes per inch—19,200 bytes, or
characters, per foot (30 cm) of tape—then each interrecord gap occupies 960 bytes
(1,600 bytes per inch*0.6 inch = 960 bytes).
Suppose that each logical record is 80 bytes. If each physical record contains only one
logical record (the default), you can write 18.5 physical records (18.5 logical records)
per foot of tape (19,200 bytes/(80 bytes per physical record + 960 bytes per physical
record) = 18.5 records). If, instead, you specify 10 logical records per physical record,
giving each physical record 800 bytes, you can write 10.9 physical records (109 logical
records) per foot of tape. If you specify 50 logical records per physical record, giving
each physical record 4 KB, you can write 3.87 physical records (193.5 logical records)
per foot of tape.
You specify the number of logical records or characters per physical record (block) with
a BLOCK CONTAINS clause in the file description entry of the file associated with the
tape drive. The BLOCK CONTAINS clause works if these conditions are met:
•
The file’s organization is sequential.
•
The file has fixed-length records.
•
When the block size is specified in characters, it is a multiple of the number of
characters in the logical record size. Also, when a RECORD CONTAINS clause
extends the record size, the block size expressed is a multiple of the number of
characters in that specified record size.
•
The file description entry does not have a LINAGE or ALTERNATE RECORD KEY
clause.
On NonStop systems, physical record (block) sizes for tapes range from 24 through
32,767 bytes. The recommended maximum tape block sizes for application programs
are:
Density (bytes per inch) Block Size (bytes)
800 4,096
1,600 8,192
6,250 32,767