Guardian Programmer's Guide

Table Of Contents
Communicating With Disk Files
Guardian Programmer’s Guide 421922-014
5 - 10
Creating Unstructured Files
The following example interactively creates an unstructured file with a buffer size of
512 bytes using the FUP CREATE command:
1> FUP
-SET TYPE U
-SET BUFFERSIZE 512
-SHOW
TYPE U
EXT ( 1 PAGES, 1 PAGES )
MAXEXTENTS 16
BUFFERSIZE 512
-CREATE $ADMIN.OPERATOR.LOGFILE
CREATED - $ADMIN.OPERATOR.LOGFILE
-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 following example programmatically creates the same file using the
FILE_CREATE_ procedure:
STRING .FILE^NAME[0:ZSYS^VAL^LEN^FILENAME - 1];
INT LENGTH;
INT FILE^TYPE := 0;
INT BUFFER^SIZE := 512;
.
.
FILE^NAME ':=' "\SYS.$ADMIN.OPERATOR.LOGFILE" -> @S^PTR;
LENGTH := @S^PTR '-' @FILE^NAME;
CALL FILE_CREATE_(FILE^NAME:ZSYS^VAL^LEN^FILENAME,
LENGTH,
!file^code!,
!primary^extent^size!,
!secondary^extent^size!,
!max^extents!,
FILE^TYPE,
!options!,
!record^len!,
BUFFER^SIZE);
As for any disk file, you should also consider the desired extent sizes for your file. The
above example creates a file using the default extent sizes of 1 page for the primary
extent and 1 page for each of the secondary extents. Refer to Section 2, Using the
File System, for details of setting extent sizes.