Disk formats
BS2000 now supports disks with different formats:
Keyed volumes (or K disks) are used for files in which block control information is stored in a separate field (“Pamkey”) for each 2K data block. These files have the PAMKEY block format.
Non-Key volumes (or NK disks) are used for files in which no separate Pamkey fields exist, i.e. files that have no block control information (block format NO) or files in which the block control information is stored in each respective data block (block format DATA).
NK volumes are differentiated on the basis of the minimum transfer unit. NK2 volumes have the usual transfer unit of 2K; NK4 volumes have a transfer unit of 4K.
When using NK4 volumes, it is important to ensure that the record lengths correspond to an even blocking factor.
The block format of a COBOL file can be defined with the BLOCK-CONTROL-INFO operand of the ADD-FILE-LINK command:
/ADD-FILE-LINK ..., -
/ BLOCK-CONTROL-INFO = BY-PROGRAM / BY-CATALOG / WITHIN-DATA-BLOCK / PAMKEY / NO
Two additional operand values are available for NK-ISAM files:
WITHIN-DATA-2K-BLOCK / WITHIN-DATA-4K-BLOCK
A detailed description of the BLOCK-CONTROL-INFO operand, the various file and volume formats, and the conversion of K file formats to NK file formats can be found in the “Introductory Guide to DMS” [4].
If the values specified in the BLOCK-CONTROL-INFO or BUFFER-LENGTH operands of the ADD-FILE-LINK command are not compatible with
the block format of the file or
the volume on which the file is stored or
the required blocking factor,
file processing is aborted without success, and the runtime system reports the fact with I-O status (File Status) 95.
If no ADD-FILE-LINK command is used for a COBOL file, the default value to be set by the system administrator in the BLKCTRL operand of the CLASS2-OPTION applies.
K-ISAM and NK-ISAM files
ISAM files in K format that use the maximum record length become longer than the usable area of the data block when converted to NK format. But they can still be handled in NK format because the DMS extends the data block by creating so-called “overflow blocks”.
The creation of overflow blocks is attended by the following problems:
The overflow blocks increase space requirements on the disk and thus the number of input/output operations during file processing.
The ISAM key must never be located within an overflow block.
Overflow blocks can be avoided by ensuring that the longest record in the file is shorter than the usable area of a logical block in NK-ISAM files.
The following table shows how to calculate how much space per logical block is available for data records in ISAM files.
File format | RECORD-FORMAT | Maximum usable area |
K-ISAM | VARIABLE | BUF-LEN |
FIXED | BUF-LEN - (s*4) where s = number of records per logical block | |
NK-ISAM | VARIABLE | BUF-LEN - (n*16) - 12 - (s*2) where n = blocking factor |
FIXED | BUF-LEN - (n*16) - 12 - (s*2) - (s*4) where n = blocking factor |
Table 17: Maximum usable block area in ISAM files
Explanation of the formulae:
With RECORD-FORMAT=FIXED, every record of both K-ISAM and NK-ISAM files contains a 4-byte record length field, but this is not included in the RECSIZE value. In these cases, therefore, it is necessary to deduct 4 bytes per record.
In NK-ISAM files, each PAM page of a logical block contains 16 bytes of management information. The logical block additionally contains a further 12 bytes of management information and a 2-byte record pointer per record.
Example 9-5
Maximum record length for an NK-ISAM file (fixed-length records)
File declaration:
maximum record length (according to the formula in table 17): |
K-SAM and NK-SAM files
SAM files do not have overflow blocks. This means that SAM files in K format that use the maximum record length are not converted to NK-SAM files. COBOL programs that work with records having the maximum length possible for K-SAM files are not executable with NK-SAM files.
The following table shows how much space per logical block is available for data records in SAM files.
File format | RECORD-FORMAT | Maximum usable area |
K-SAM | VARIABLE | BUF-LEN - 4 |
FIXED / UNDEFINED | BUF-LEN | |
NK-SAM | VARIABLE / FIXED / UNDEFINED | BUF-LEN - 16 |
Table 18: Maximum usable block area in SAM files
The reason for deducting 4 bytes from the block size in K-SAM files with variable-length records is that the logical blocks of such files contain a 4-byte block length field that is not counted in the BUF-LEN value.