Enscribe Programmer's Guide
value^list.key^length := 2;
value^list.pri^extent := 32;
value^list.sec^extent := 8;
value^list.fileformat := 2; !format 2
value^list.altkeys := num^altkeys;
value^list.altkey^descr[0].key^specifier ':=' "LO";
value^list.altkey^descr[0].key^length := 4;
value^list.altkey^descr[0].key^offset := 42;
value^list.altkey^descr[0].key^filenum := 0;
value^list.altkey^descr[0].null^value := 0;
value^list.altkey^descr[0].attributes := 0;
value^list.altkey^descr[1].key^specifier ':=' "VN";
value^list.altkey^descr[1].key^length := 8;
value^list.altkey^descr[1].key^offset := 46;
value^list.altkey^descr[1].key^filenum := 0;
value^list.altkey^descr[1].null^value := 0;
value^list.altkey^descr[1].attributes := 0;
value^list.num^alt^key^files := num^altkey^files;
value^list.name^length^info[0].file^name^len := 6;
value^list.file^names ':=' "INVALT";
ERROR := FILE_CREATELIST_ (filename:name^length,namelen,
item^list, item^list^len, value^list,
$LEN(value^list), error2);
END;
When you use a system procedure to create your key-sequenced file, you must create your alternate
key files separately. For more information, see “Accessing Key-Sequenced Files” (page 85).
Example 4: Creating an Alternate-Key File
When you use FUP to create the primary file, FUP automatically creates any required alternate-key
files. If you create the primary file programmatically, however, you must create the alternate-key
file yourself as a separate operation.
You could create the alternate-key file for “Example 2: Creating a Key-Sequenced File With Alternate
Keys” (page 77) by including this TAL code in one of your application modules.
The volume name, subvolume name, and node name are not specified in the procedure call.
FILE_CREATE_ obtains them from the current value of the VOLUME attribute of the =_DEFAULTS
DEFINE.
LITERAL name^length = 6,
pri^extent = 32,
file^code = 1002,
sec^extent = 8,
file^type = 3,
rec^len = 12,
data^block^len = 4096,
options = %10, ! data compression
key^len = 12, ! max. alternate key length
! + primary-key length
! + 2
key^offset = 0;
INT error;
INT namelen;
STRING .filename [0:name^length-1] := "INVALT";
namelen := name^length;
error := FILE_CREATE_(filename:name^length, namelen,
file^code, pri^extent, sec^extent,, file^type,
options, rec^len, data^block^len, key^len,
key^offset);
IF Error <> 0 THEN ... ! error
82 Key-Sequenced Files