Guardian Programmer's Guide

Table Of Contents
Communicating With Disk Files
Guardian Programmer’s Guide 421922-014
5 - 82
Creating Alternate-Key Files
The next example creates the same files programmatically using the
FILE_CREATELIST_ procedure. You supply this procedure with an item-list and a
list of corresponding values. The item-list parameter is an array of numbers that
identify the values given in the values parameter. In the example below, item number
41 identifies the first word of the values array as the file type, item number 43
identifies the second word as the record length, and so on.
?NOLIST
?INSPECT,SYMBOLS
?SOURCE $SYSTEM.ZSYSDEFS.ZSYSTAL
! Global variables:
STRING .S^PTR;
.
.
?SOURCE $SYSTEM.SYSTEM.EXTDECS0
?LIST
.
.
PROC CREATE^ALTS MAIN;
BEGIN
STRING .KEYSFILE[0:ZSYS^VAL^LEN^FILENAME]; !primary-key
! file name
INT LENGTH; !length of primary file name
INT .ITEM^LIST[0:63]; !list of items to pass to
! FILE_CREATELIST_
INT .VALUES[0:512]; !values of those items
INT NUMBER^ITEMS; !number of items
INT VALUES^LEN; !total length of items
INT REC^LEN; !alternate-key file record
! length
INT BLOCK^LEN; !alternate-key file block
! length
INT KEY^LEN; !alternate-key file key
! length
INT KEY^OFFSET; !alternate-key file key
! offset
INT ERROR; !system procedure call error
KEYSFILE ':=' "$ADMIN.OPERATOR.KEY2FILE" -> @S^PTR;
LENGTH := @S^PTR '-' @KEYSFILE;