Enscribe Programmer's Guide
record that is longer than the defined maximum record length, the file system rejects the operation
and returns an error 21 (illegal count).
Blocks
A block is the unit of information transferred between the disk process and the disk (or, when you
are using sequential block buffering, between the disk process and the process file segment). A
block consists of one or more logical records and, in the case of key-sequenced files, associated
control information. This control information, which is used only by the system, is summarized in
“Block Formats of Structured Files” (page 169).
The block size of a key-sequenced file with increased limits can be 512 bytes, 1 KB, 2 KB, 4 KB,
or 32 KB.
Regardless of the record length, the maximum number of records that can be stored in a single
block is 511 for a format 1 file. For a format 2 file, it is limited by the block and record sizes.
A record cannot span block boundaries (that is, it cannot begin in one block and end in another).
Therefore, the block size for a key-sequenced file must be at least:
• record-length + 2 + 32 bytes for format 1 files
• record-length + 4 + 52 bytes for format 2 files
For key-sequenced files, the disk process requires that the size of the file's index blocks (IBLOCK
parameter of a FUP SET command) and data blocks (BLOCK parameter of a FUP SET command)
be the same. Accordingly, when you are creating a key-sequenced file, the disk process ignores
whatever IBLOCK size you might specify and uses instead (as both the BLOCK and IBLOCK values)
whatever you specify for BLOCK.
When choosing the block size, remember that while longer index blocks require more space in
the cache buffer they can also reduce the number of indexing levels (thereby reducing the number
of accesses to the disk).
The block size of a key-sequenced file should be large in relation to the record size, and especially
so in relation to the key size, to reduce the number of block splits as records are inserted into the
file. Furthermore, a larger data block implies more data records per block and therefore fewer
index records and fewer index blocks.
Disk Extent Size
When you create an Enscribe file, you can specify these:
• The size of the primary and secondary extents. The primary partition for format 2 files have
a primary extent size greater than or equal to 140 pages. Each secondary partition has its
own primary and secondary extent size. The maximum extent size for a format 2 file is
536,870,912 pages. Format 1 files are restricted to: 1 to 65,535 pages, where a page is
2048 bytes.
• The maximum number of extents to be allocated for the file (16 or more for a key-sequenced
file or any of its partitions).
• The system defaults to format 2 if any of the following is true:
Secondary partition is greater than 15◦
◦ Primary or alternate key size is greater than 255
◦ Block size is greater than 4 KB
◦ Record size is greater than 4 KB
If you do not specify extent sizes, both the primary and secondary extent sizes default to one page.
If you do not specify the maximum number of extents, MAXEXTENTS defaults to 16.
74 Key-Sequenced Files