Enscribe Programmer's Guide
? READ)
?LIST
PROC DO^THE^WORK MAIN;
BEGIN
namelen := name^length;
ERROR := FILE_CREATE_ (filename:name^length,namelen,,
pri^extent, sec^extent,, file^type,, rec^len,
data^block^len);
ERROR := FILE_OPEN_ (filename:name^length, filenum);
ERROR := FILE_CLOSE_ (filenum);
END;
Example 2: Creating an Entry-Sequenced File With Alternate Keys
This example shows how to create the file illustrated in Section : Example 1: Creating an
Entry-Sequenced File, but defines the terminal-number field as an alternate key.
Byte Offset:
0 10 16 24
06555404
transid date time-stamp account-number
trans-type amount-transacted terminal-number
Alternate-Key
Field TN
You could create the file by using these FUP commands:
>volume $store1.svol1
>fup
-set type e
-set ext (1000,500)
-set rec 60
-set block 4096
-set altkey ("tn",keyoff 55,keylen 5)
-set altfile (0,alttran)
-show
TYPE E
EXT ( 1000 PAGES, 500 PAGES )
REC 60
BLOCK 4096
ALTKEY ( "TN", FILE 0, KEYOFF 55, KEYLEN 5 )
ALTFILE ( 0, $STORE1.SVOL1.ALTTRAN )
ALTCREATE
-create tranfile
CREATED - $STORE1.SVOL1.TRANFILE
CREATED - $STORE1.SVOL1.ALTTRAN
Using the FILE_CREATE_ system procedure, you could create the file by including this TAL code in
one of your application modules:
LITERAL name^length = 22,
num^altkeys = 1,
num^altkey^files = 1,
item^list^len = 10;
INT error;
INT error2;
INT namelen;
STRING .filename [0:name^length-1] :=
Creating Entry-Sequenced Files 127