Guardian Programmer's Guide

Table Of Contents
Communicating With Disk Files
Guardian Programmer’s Guide 421922-014
5 - 51
Locking, Renaming, Caching, Closing, Purging, and
Altering Key-Sequenced Files
So far, sequential reading of a key-sequenced file has been assumed to mean reading
records in ascending key sequence. By setting bit 1 of the positioning-mode
parameter, however, you can read sequentially in descending key sequence.
Positioning is unnecessary when writing a new record to a key-sequenced file. The
Enscribe software responds to the WRITEX call by inserting the new record into the file
in position according to its key value.
Locking, Renaming, Caching, Closing, Purging, and Altering
Key-Sequenced Files
The operations of locking, renaming, closing, and purging key-sequenced files, altering
key-sequenced-file attributes, and avoiding unnecessary cache flushes of key-
sequenced files are the same as for any disk file. See Using Unstructured Files earlier
in this section.
Key-Sequenced File Programming Example
A different application will be used to illustrate the use of key-sequenced files. This
example provides access to a key-sequenced file that contains an inventory.
Information about each item is stored in a record accessible by part number. The
record structure is as follows:
You can create the key-sequenced file required by this program using the
FILE_CREATE[LIST]_ procedure as described under Creating Key-Sequenced Files
earlier in this section. Or you can simply use FUP commands as shown below:
1> FUP
-SET TYPE K
-SET BLOCK 2048
-SET REC 134
-SET IBLOCK 2048
-SET KEYLEN 6
-SHOW
TYPE K
EXT ( 1 PAGES, 1 PAGES )
REC 134
BLOCK 2048
IBLOCK 2048
KEYLEN 6
KEYOFF 0
MAXEXTENTS 16
-CREATE $APPL.SUBAPPL.PARTFILE
CREATED - $APPL.SUBAPPL.PARTFILE
027CDT .CDD
supplier
60
bytes
desc-len
2
bytes
part number description supp-len quantity price
6
bytes
60
bytes
2
bytes
2
bytes
2
bytes