Guardian Programmer's Guide

Table Of Contents
Communicating With Disk Files
Guardian Programmer’s Guide 421922-014
5 - 31
Using Entry-Sequenced Files
5 Communicating With Disk Files
Using Entry-Sequenced Files
Entry-sequenced files have a different structure than relative files, therefore file
creation is different. File access is also different; random file access, for example, is
done by record address instead of record number. This subsection discusses how to
use entry-sequenced files, placing emphasis on file creation and file access because
these are the operations that differ from operations performed on other structured file
types. At the end of the subsection is a sample program showing I/O operations on an
entry-sequenced file.
The discussion here is limited to primary-key access, that is, by record address.
Alternate keys are discussed later under the heading Using Alternate Keys.
Creating Entry-Sequenced Files
You can create an entry-sequenced file either interactively using the FUP CREATE
command or programmatically using the FILE_CREATE[LIST]_ procedure. In either
case, you need to supply information about how to build the file, including the
appropriate file type, block length, and record length.
The following example creates an entry-sequenced file interactively using the FUP
CREATE command:
1> FUP
-SET TYPE E
-SET BLOCK 4096
-SET REC 4072
-SHOW
TYPE E
EXT ( 1 PAGES, 1 PAGES )
REC 4072
BLOCK 4096
MAXEXTENTS 16
-CREATE $ADMIN.OPERATOR.ESFILE
CREATED - $ADMIN.OPERATOR.ESFILE
-EXIT
2>
Refer to the File Utility Program (FUP) Reference Manual for more details on how to
create files using the FUP CREATE command.
The next example creates the same file programmatically using the FILE_CREATE_
procedure:
STRING .FILE^NAME[0:ZSYS^VAL^LEN^FILENAME - 1];
INT LENGTH;
INT FILE^TYPE := 2;
INT RECORD^LENGTH := 4072;
INT BLOCK^LENGTH := 4096;
.
.