Guardian Programmer's Guide

Table Of Contents
Communicating With Disk Files
Guardian Programmer’s Guide 421922-014
5 - 73
Using Alternate Keys With a Key-Sequenced File
To create the data and alternate-key files, you can use the FILE_CREATE_ procedure
as described under Creating Alternate-Key Files earlier in this subsection, or you can
use the FUP utility as follows:
1> FUP
-SET TYPE K
-SET REC 134
-SET BLOCK 4096
-SET IBLOCK 4096
-SET KEYLEN 6
-SET ALTKEY("DE",KEYOFF 6,KEYLEN 60)
-SET ALTFILE(0, ALT2)
-SHOW
TYPE K
EXT ( 1 PAGES, 1 PAGES )
REC 130
BLOCK 4096
IBLOCK 4096
KEYLEN 6
KEYOFF 0
ALTKEY( "DE", FILE 0, KEYOFF 6, KEYLEN 60)
ALTFILE(0, $ADMIN.OPERATOR.ALT2)
ALTCREATE
MAXEXTENTS 16
-CREATE KEY2FILE
CREATED $ADMIN.OPERATOR.KEY2FILE
CREATED $ADMIN.OPERATOR.ALT2
-EXIT
2>
Few changes need to be made to the old program, because the same record structure
as before is used. The only change is in the READ^RECORD procedure, which now
prompts the user whether the access is to be by part number or by part description. If
the user chooses to access by part number, then the procedure prompts for the part
number as before. If the user chooses to access the file by part description, then the
procedure uses “DE” (short for “description”) as the key specifier. Because the part
Figure 5-7. Example of Alternate-Key File for Use With a Key-Sequenced File
VST031.VSD