Enscribe Programmer's Guide

-VOLUME $vol1.svol
-RESET
-SET TYPE K
-SET KEYLEN 19
-SET REC 19
-SET EXT (9000,1000)
-SET PART (1,$vol2,9000,1000,"SNM")
-CREATE altfile
If the primary file contains any data, the empty alternate key file will be loaded with the associated
key records. In this example, the primary file is named PRIFILE, and it specifies ALTFILE as its
alternate key file number 0.
The FUP command to load the newly created alternate file is:
-LOADALTFILE 0, prifile
For more information on FUP commands, see the File Utility Program (FUP) Reference Manual.
Loading a Partitioned, Alternate-Key File
For this example, primary file $VOL1.SVOL.PRIFILE is a key-sequenced file having a primary-key
field 10 bytes long. The file has three alternate-key fields identified by the key specifiers F1, F2,
and F3. Each of these alternate-key fields is 10 bytes long.
All of the alternate-key records are contained in a single alternate-key file that is partitioned over
three volumes. Each volume contains the alternate-key records for one alternate-key field; the key
specifier for each alternate-key field is also the partial-key value for the associated secondary
partition.
The alternate-key file's primary partition is $VOL1.SVOL.ALTFILE. That partition contains the
alternate-key records for the key specifier F1. The first secondary partition, $VOL2.SVOL.ALTFILE,
contains the alternate-key records for the key specifier F2. The second secondary partition,
$VOL3.SVOL.ALTFILE, contains the alternate-key records for the key specifier F3.
The commands to load the alternate-key records for key specifier F2 into $VOL2.SVOL.ALTFILE
are:
>FUP
-VOLUME $vol1.svol
-CREATE sortin, ext 30
-CREATE sortout, ext 30
-BUILDKEYRECORDS prifile,sortin,"F2",RECOUT 22,BLOCKOUT 2200
-EXIT
>SORT
<FROM sortin, RECORD 22
<TO sortout
<ASC 1:22
<RUN
<EXIT
>FUP
-VOLUME $vol1.svol
-LOAD sortout, $vol2.altfile, SORTED, PARTOF $vol1, RECIN 22,
BLOCKIN 2200
-PURGE ! sortin, sortout
The CREATE commands create the disk file used as the output of BUILDKEYRECORDS (which is
also the input to SORT) and the disk file to be used as the output of SORT.
The BUILDKEYRECORDS command generates the alternate-key records for key specifier F2 of
PRIFILE and writes the records to SORTIN. Record-blocking is used to improve the efficiency of disk
writes.
The SORT program sorts the alternate-key records. The key-field length for the sort is the same as
the alternate-key record length (22: 2 for the key specifier + 10 for alternate-key field length + 10
for the primary-key field length). The output file of the sort is SORTOUT.
Loading a Partitioned, Alternate-Key File 163