Guardian Programmer's Guide

Table Of Contents
Using the IOEdit Procedures
Guardian Programmer’s Guide 421922-014
14 - 9
Opening a Nonexistent File
²
The access mode is read-only by default. Note that this is different from
FILE_OPEN_ which has a default access mode of read/write.
The exclusion mode is shared by default, as for the FILE_OPEN_ procedure.
Nowait I/O is implied by default. Note that this is different from the default mode
used by FILE_OPEN_. Moreover, the behavior of nowait I/O is different for IOEdit
than for Enscribe files.
IOEdit passes the nowait attribute to the FILE_OPEN_ procedure to open the EDIT
file for nowait I/O. Once the file is open, IOEdit buffers write operations until either
a full page of text has been entered or the application calls the CLOSEEDIT_
procedure. IOEdit then writes the entire page to disk with one nowait I/O operation
and immediately continues to fill the next page. If you specify waited I/O, then the
write to disk is done using waited I/O.
Whether the file is opened with waited or nowait I/O does not affect the way the
application functions: I/O operations return as soon as the access to the buffer in
the EFS is complete. Nowait I/O, however, results in improved performance
because of the ability to continue writing to the buffers while the last completed
page is being written to disk.
The writethrough parameter causes write operations to go straight to disk,
without using the EFS buffers. Normally, this feature is turned off. Use it with care
because the writethrough feature reduces application performance.
The following example opens a text file called DIARY, accepting the default values of
shared, read-only access, and nowait I/O for writing out the buffers:
FILE^NAME ':=' "$USERVOL.MYSUBVOL.DIARY" -> @S^PTR;
NAME^LEN := @S^PTR '-' @FILE^NAME;
FILE^NUM := -1;
ERROR := OPENEDIT_(FILENAME:NAME^LEN,
FILE^NUM,
!access^mode!,
!exclusion^mode!,
!nowait^mode!,
!sync^depth!,
!writethrough!);
IF ERROR > 0 THEN ...
Opening a Nonexistent File
To open an EDIT file that does not yet exist, the OPENEDIT_ procedure:
1. Creates the EDIT file by calling the FILE_CREATE_ procedure
2. Opens the file by calling the FILE_OPEN_ procedure
3. Initializes the IOEdit data structures in the EFS by calling the INITIALIZEEDIT
procedure