Enscribe Programmer's Guide
The LOADALTFILE command loads PRIFILE's key file 0 ($VOL1.SVOL.ALTFILE) with the alternate-key
records for key specifier NM and for any other alternate keys defined for key file zero. An index
block slack percentage of 10 is specified.
Creating an Alternate-Key File
This example creates an alternate-key file for the primary file $VOL1.SVOL.FILEA, which is an
entry-sequenced file. The new alternate-key file will be named $VOL1.SVOL.FILEB. The alternate-key
records for the new key field will be added to FILEB.
The key specifier for the new key is XY, the key offset in the record is 0, and the key length is 10.
The FUP commands to perform this operation are:
-VOLUME $vol1.svol
-CREATE fileb, type K, rec 16, keylen 16
-ALTER filea, ALTFILE ( 0, fileb ), ALTKEY ( "XY", KEYLEN 10)
-LOADALTFILE 0, filea
The CREATE command creates the alternate-key file ($VOL1.SVOL.FILEB). Both the record length
and key length are specified as 16 bytes (2 for the key specifier + 10 for the alternate-key field
lengths + 4 for the primary-key length).
The ALTER command changes the file label for FILEA so that it refers to FILEB as alternate-key file
0 and contains the definition for the key field specified by key specifier XY.
The LOADALTFILE command loads FILEA's key file 0 ($VOL1.SVOL.FILEB) with the alternate-key
records for key specifier XY. An index block slack percentage of 0 is implied.
Reloading a Key-Sequenced File Partition
For this example, the primary partition of the partitioned file is $VOL1.SVOL.PARTFILE. Its first
secondary partition is on $VOL2 and its second secondary partition is on $VOL3. The secondary
partition on $VOL2 is to be reloaded.
The FUP commands to perform this operation are:
-VOLUME $vol1.svol
-SET LIKE $vol2.partfile
-SET NO PARTONLY
-CREATE temp
-DUP $vol2.partfile, temp, OLD, PARTONLY
-LOAD temp, $vol2.partfile, SORTED, PARTOF $vol1
-PURGE temp
The SET and CREATE commands create a file identical to $VOL2.SVOL.PARTFILE except that the
file is designated as a nonpartitioned file by means of NO PARTONLY.
The DUP command duplicates the data in the secondary partition ($VOL2.SVOL.PARTFILE) into
$VOL1.SVOL.TEMP.
The LOAD command reloads the secondary partition $VOL2.SVOL.PARTFILE from the file
$VOL1.SVOL.TEMP. The LOAD command includes the SORTED option because the records in the
TEMP file are already in sorted order.
Creating a Partitioned Alternate-Key File
This example creates a partitioned form of an alternate key file. Partitioning allows a file to hold
more data and to share I/Os between more than one physical disk. For this example, the primary
file has a primary-key field 10 bytes long and an alternate key field 7 bytes long, with the key
specifier “SN”. The alternate key file is $VOL1.SVOL.ALTFILE, which has not been created yet.
The alternate key values starting with the letters “A” through “L” will have records placed into the
first partition, and key values starting with the letters “M” through “Z” will be placed into the second
partition. The partitions of the alternate key file will reside on volumes $VOL1 and $VOL2.
The FUP commands to perform this operation are:
162 File Loading