Compaq COBOL AAQ2G1FTK User Manual
Page 513
Optimizing Your Compaq COBOL Program
15.7 Optimizing File Design (OpenVMS)
•
Index records:
Record size = key size + 3
If a file has more than 65,536 blocks, the 3-byte index record overhead could
increase to 5 bytes.
Use these calculations to determine SIDR record length:
•
No duplicates allowed:
Record size = key size + 9
•
Duplicates allowed:
Record size = key size + 8 + 5 3 (number of duplicate records)
Note
Bucket packing efficiency determines how well bucket space is used. A
packing efficiency of 1 means the buckets of an index are full. A packing
efficiency of .5 means that, on the average, the buckets are half full.
Consider an indexed file with these attributes:
•
100,000 fixed-length records of 200 characters each
•
Primary key = 20 characters
•
Alternate key = 8 characters, no duplicates allowed
•
Bucket size = 3 (an arbitrary value)
•
No fill number
Primary key index level calculations:
In the following calculations, some results are to be rounded up, and some
truncated.
Level 0 (data level buckets):
data records per bucket =
bytes per bucket 0 15
record size + 7
(result is truncated)
=
1536 0 15
200 + 7
= 7 data records per bucket
number of data buckets =
number of data records
records per bucket
(result is rounded up)
=
100; 000
7
= 14; 286 buckets to contain all data records:
Level 1 (index buckets):
index records per bucket =
bytes per bucket 0 15
key size + 3
(result is truncated)
=
1536 0 15
20 + 3
= 66 index records per bucket
number of index buckets =
no: of buckets from level (n 0 1)
index records per bucket
(result is rounded up)
=
14; 286
66
= 217 level 1 buckets to address all data buckets at level 0
Optimizing Your Compaq COBOL Program 15–23