COBOL Manual for TNS and TNS/R Programs
Data Division
HP COBOL Manual for TNS and TNS/R Programs—522555-006
7-16
File Description Entries
When blk-1 is present, its value must be less than or equal to that of blk-2.
When the RECORDS option is not specified, the value of blk-1 must be greater
than or equal to the minimum record size of the file; otherwise, the value of blk-1
must be greater than 0.
Although tape devices are capable of handling blocks of 32,767 characters,
unstructured disk files are limited to a block size of 4,096. Furthermore, an
unstructured disk file can have a BLOCKSIZE attribute that is smaller than 4,096.
Other devices have their own block size limitations. See the discussion of the
WRITE procedure call in the Guardian Procedure Errors and Messages Manual for
these limits.
Because the compiler cannot determine the block size of the device that is
ultimately associated with a file, you must choose the correct block size and record
size or risk getting a run-time error.
•
Blocking and Deblocking for Tape and Unstructured Disk
A BLOCK CONTAINS clause is effective (HP COBOL performs record blocking
and deblocking) only when all of these conditions are met, and the file associated
at open time is either a tape unit or an unstructured disk file:
°
The file’s organization is sequential.
°
The file has fixed-length records. This condition is met only when the file
description contains either no RECORD CONTAINS or RECORD VARYING
clause or contains a RECORD CONTAINS clause that specifies only a single
record size.
°
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 is not described with a LINAGE or ALTERNATE RECORD KEY clause.
°
Tape Files
If the actual file associated with the COBOL file at open time is a tape unit,
then blocking/deblocking always occurs. For an unlabeled tape file, the
maximum block size is the one specified in the BLOCK CONTAINS clause. For
a labeled tape file, the maximum block size specified in the tape label (which
must be an exact multiple of the logical record size) overrides the one specified
in the BLOCK CONTAINS clause.
If the file is opened for INPUT, then each physical block on the tape medium
must contain one or more complete logical records. The size of a block must
not exceed the maximum block size; however, any block can be smaller than
the maximum block size (can contain fewer than the potential number of logical
records).