Enscribe Programmer's Guide
6 Key-Sequenced Files
Enscribe Key-Sequenced Files
NOTE: As of the H06.28 and J06.17 RVUs, format 2 legacy key-sequenced 2 (LKS2) files with
increased limits, format 2 standard queue files with increased limits, and enhanced key-sequenced
(EKS) files with increased limits are introduced. EKS files with increased limits support 17 to 128
partitions along with larger record, block, and key sizes. LKS2 files with increased limits and format
2 standard queue files with increased limits support larger record, block, and key sizes. When a
distinction is not required between these file types, key-sequenced files with increased limits is used
as a collective term. To use increased Enscribe limits, the minimum RVUs are H06.28 and J06.17
with specific SPRs. (These SPR requirements could change or be eliminated with subsequent RVUs.)
For a list of the required H06.28/J06.17 SPRs, see SPR Requirements for Increased Enscribe Limits
for the H06.28/J06.17 Release (page 18).
NOTE: As of the H06.22 and J06.11 RVUs, a new Enscribe file type: enhanced key-sequenced
(EKS) file is introduced and extends the Enscribe partition maximum to 64. An EKS file supports
17 to 64 partitions. The previous Enscribe key-sequenced file type supports 1 to 16 partitions and
is referred to as a legacy key-sequenced (LKS) file in this manual. When a distinction is not required
between these file types, key-sequenced file is used as a collective term.
Enscribe key-sequenced files consist of variable-length records that are accessed by the values
contained within designated key fields. There are two types of keys: primary and alternate. All
records in a key-sequenced file contain a primary key. The use of alternate keys is optional.
The primary key field is designated when a key-sequenced file is created. It can be any set of
contiguous bytes within the data record. The records in a key-sequenced file are stored logically
in ascending order according to the value contained in their primary-key field.
A record can vary in length from one byte to the maximum record size specified when the file was
created. For the maximum record sizes of key-sequenced files, see Table 7 (page 47). The number
of bytes allocated for a record is the same as that written when the record was inserted into the
file. Each record has a length attribute that is optionally returned when a record is read. A record's
length can be changed after the record has been inserted (with the restriction that the length cannot
exceed the specified maximum record size). Records in a key-sequenced file can be deleted.
A good example of the use of key-sequenced files in an application environment is an inventory
file in which each record describes a part. The primary key field for that file would probably be
the part number, so the file would be ordered by part number. Other fields in the record would
contain such information as vendor name, quantity on hand, and so forth, and one or more of
them can be designated as alternate key fields. Note that the Enscribe software is concerned only
with key fields; the content and location of all other fields in each record is solely the concern of
the application.
Applicable System Procedures
Use these system procedures to create and access Enscribe key-sequenced files:
• FILE_CREATE_, FILE_CREATELIST_
• FILE_OPEN_, FILE_CLOSE_, AWAITIO[X], FILE_AWAITIO64_
• FILE_LOCKFILE64_, FILE_LOCKREC64_, FILE_UNLOCKFILE64_,
FILE_UNLOCKREC64_, LOCKFILE, LOCKREC, UNLOCKFILE, UNLOCKREC
• FILE_SETKEY_, FILE_SETPOSITION_, FILE_SAVEPOSITION_, FILE_RESTOREPOSITION_,
KEYPOSITION[X], SAVEPOSITION, REPOSITION
68 Key-Sequenced Files