Guardian Programmer's Guide

Table Of Contents
Communicating With Disk Files
Guardian Programmer’s Guide 421922-014
5 - 16
Creating Relative Files
Creating Relative Files
You can create a relative 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 size, and maximum record length.
The following example creates a relative file interactively using the FUP CREATE
command:
1> FUP
-SET TYPE R
-SET BLOCK 4096
-SET REC 128
-SHOW
TYPE R
EXT ( 1 PAGES, 1 PAGES )
REC 128
BLOCK 4096
MAXEXTENTS 16
-CREATE $ADMIN.OPERATOR.RELFILE
CREATED - $ADMIN.OPERATOR.RELFILE
-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 := 1;
INT RECORD^LENGTH := 128;
INT BLOCK^LENGTH := 4096;
.
.
FILE^NAME ':=' "\SYS.$HR.RECORDS.EMPFILE" -> @S^PTR;
LENGTH := @S^PTR '-' @FILE^NAME;
ERROR := FILE_CREATE_(FILE^NAME:ZSYS^VAL^LEN^FILENAME,
LENGTH,
!file^code!,
!primary^extent^size!,
!secondary^extent^size!,
!max^extents!,
FILE^TYPE,
!options!,
RECORD^LENGTH,
BLOCK^LENGTH);
IF ERROR <> 0 THEN ...
A file type of 1 specifies a relative file.