Enscribe Programmer's Guide

Format 1 Files
For relative format 1 files, the maximum length of a logical record is 24 bytes less than the block
size. Using the maximum allowed block size of 4096, the absolute maximum logical record size
allowed for relative files is 4072 bytes.
Format 2 Files
For relative format 2 files, the maximum length of a logical record is 48 bytes less than the block
size. Using the maximum allowed block size of 4096, the absolute maximum logical record size
allowed for relative files is 4048 bytes. The error 579 will be returned if the record size exceeds
the applicable limit.
The data records that you write to a relative file can be of varying lengths, but none can exceed
the maximum logical record size specified when the file was created. If you try to write a record
that is longer than the defined maximum record length, the file system rejects the insert operation
with an error 21 (illegal count).
Blocks
A block is the unit of information transferred between the disk process and the disk. A block consists
of one or more logical records and, in the case of relative 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 an Enscribe relative file must be 512 bytes, 1 KB, 2 KB, or 4 KB.
The block size must include 22 or 44 bytes per block for block control information and 2 or 4
bytes per record for record control information. Therefore, the maximum number of records that
you can store in each block is:
N = (block-size - 22) / (record-size + 2) for Format 1 Files
N = (block-size - 44) / (record-size + 4) for Format 2 Files
Regardless of the record length, the maximum number of records that can be stored in a single
block is 511 for format 1 files and 32767 for format 2 files.
A record cannot span block boundaries (that is, it cannot begin in one block and end in another).
Therefore, the block size for a relative file must be at least record-length + 2 + 22 bytes for
format 1 files and record-length + 4 + 44 bytes for format 2 files
Disk Extent Size
When you create an Enscribe relative file, you can specify:
The size of the primary and secondary extents. Format 1 files can have from 1 through 65,535
pages (where a page is 2048 bytes), while format 2 files can have from 1 through
536,870,912 pages
The maximum number of extents to be allocated for the file (16 or more for a nonpartitioned
relative file)
If you do not specify extent sizes, both the primary and secondary extents sizes default to one
page.
If you do not specify a maximum number of extents, MAXEXTENTS defaults to 16.
For nonpartitioned relative files, you can change the MAXEXTENTS value dynamically during
program execution using either a SETMODE 92 procedure call or a FUP ALTER command.
File Creation Examples
The examples that follow show how to create a relative file, a relative file with alternate keys, an
alternate-key file, and a partitioned relative file.
Creating Relative Files 137