Enscribe Programmer's Guide

For entry-sequenced files, the maximum length of a logical record is 24 bytes (or 48 bytes for
format 2 files) less than the block size. The maximum allowed block size for format 2 files is 4 KB.
The data records that you write to an entry-sequenced 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 operation
and returns 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 entry-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 an Enscribe entry-sequenced file must be 512 bytes, 1 KB, 2 KB, or 4 KB.
The block size must include 22 bytes (format 1 files) and 44 bytes (format 2 files) 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
Format 1 Files
N = ( block-size - 22 ) / ( record-size + 2 )
Format 2 Files
N = ( block-size - 44) / ( record-size + 4 )
If records are of varying lengths, then N is the average number of records per block and record-size
is the average record length.
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.
A record cannot span block boundaries (that is, it cannot begin in one block and end in another).
Therefore, the block size for an entry-sequenced 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 entry-sequenced 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 nonpartitioned
entry-sequenced files).
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.
For nonpartitioned entry-sequenced files, you can change the MAXEXTENTS value dynamically
during program execution by using either the SETMODE 92 system procedure or the FUP ALTER
command.
File Creation Examples
The pages that follow present annotated examples showing how to create:
1. An entry-sequenced file
2. An entry-sequenced file with alternate keys
3. An alternate-key file
4. A partitioned entry-sequenced file
Creating Entry-Sequenced Files 125