Overflow blocks are extensions of data blocks. They are created if records longer than the usable length of a data block are written. This occurs, for example, if the user uses records with the same keys and, when defining the record and block lengths, forgets that NK-ISAM internally appends an 8-byte time stamp to such records. Overflow blocks also result when converting K-ISAM files into NK-ISAM files if the maximum record length was utilized in the K-ISAM file. The data which “overflows” is always placed at the beginning of an overflow block, and the end of this block contains a pointer to the associated data block. The data area of the overflow block must not contain any part of the ISAM key (primary key), of the flags or of a secondary key.
Maximum record length / Usable block length
No overflow blocks will be created if the following rules are observed:
the maximum permissible record length is determined by the BLKSIZE or BUFFER-LENGTH specification: n * 2048, where 1 <= n <= 16 (for BLKSIZE=(STD,n) or BUFFER-LENGTH=*STD(SIZE=n))
the usable block size is the block size minus the space needed for management information and the time stamp
as ISAM places a 4-byte record length field in front of each record, the usable block size for records with RECFORM=F or RECORD-FORMAT=*FIXED is reduced by a further 4 bytes
This results in the following formula for the usable block size:
RECSIZE
<= n * 2032 - 16 - T - F
n | blocking factor in BLKSIZE = (STD,n), where 1 <= n <= 16 or BUFFER-LENGTH=*STD(SIZE=n) |
T | time stamp
|
F | record format
|
As each data block contains at least one record, a further 16 bytes for the management information must be taken into account when defining the record length. The table below shows the relationship between the maximum permissible record length and the usable block size for NK-ISAM files without overflow blocks for ISAM files with standard attributes (record format V, no duplicate keys).
Blocking factor n | Maximum record length = | Usable block length |
---|---|---|
1 | 2048 | 2016 |
2 | 4096 | 4048 |
3 | 6144 | 6080 |
4 | 8192 | 8112 |
5 | 10240 | 10144 |
6 | 12288 | 12176 |
7 | 14336 | 14208 |
8 | 16384 | 16240 |
9 | 18432 | 18272 |
10 | 20480 | 20304 |
11 | 22528 | 22336 |
12 | 24576 | 24368 |
13 | 26624 | 26400 |
14 | 28672 | 28432 |
15 | 30720 | 30464 |
16 | 32768 | 32496 |
Maximum key position and length
As neither the ISAM key nor the flags may extend into an overflow block, there are certain maximum values for key position (KEYPOS), key length (KEYLEN), value flag length (VALLEN) and logical flag length (LOGLEN). These values depend on the blocking factor and the record format. The permissible maximum values can be calculated from the usable block size (see table 49) with the aid of the following formulas:
ISAM key length and position:
|
KEYPOS | key position |
KEYLEN | Key length |
VALLEN | value flag (length) |
LOGLEN | logical flag (length) |
SL | Usable block length |
F | contingent on the record format:
|
Example
File attributes: | BLKSIZE = (STD,1) |
The values for KEYPOS are as follows:
RECFORM = V => KEYPOS
<= 2016 - 12 + 1 = 2005
RECFORM = F => KEYPOS
<= 2016 - 4 - 12 + 1 = 2001