Guardian Programmer's Guide

Table Of Contents
Using the File System
Guardian Programmer’s Guide 421922-014
2 - 15
Opening Files
If the name-option parameter is set to 2, then the operating system provides a
name. To set the name-option parameter to 2, we recommend using the
ZSYS^VAL^PCREATOPT^NAMEDBYSYS literal from the ZSYSTAL file. In this case,
the name:length parameter is omitted. A named-form process descriptor (a process
file name without any qualifier) is returned in DESCR:
NAME^OPTION := ZSYS^VAL^PCREATOPT^NAMEDBYSYS;
ERROR := PROCESS_CREATE_(
OBJECT^FILENAME:OBJFILENAME^LEN,
!library^file:lib^name^len!,
!swap^file:swap^name^len!,
!ext^swap^file:ext^swap^len!,
!priority!,
!processor!,
!process^handle!,
!error^detail!,
NAME^OPTION,
!name:length!,
DESCR:ZSYS^VAL^LEN^PROCESSDESCR,
DESCLEN);
If name-option is set to 0, then an unnamed process descriptor is returned in
DESCR. You can make sure that the name-option parameter is correctly set by
using the ZSYS^VAL^PCREATOPT^NONAME literal:
NAME^OPTION := ZSYS^VAL^PCREATOPT^NONAME;
ERROR := PROCESS_CREATE_(
OBJECT^FILENAME:OBJFILENAME^LEN,
!library^file:lib^name^len!,
!swap^file:swap^name^len!,
!ext^swap^file:ext^swap^len!,
!priority!,
!processor!,
!process^handle!,
!error^detail!,
NAME^OPTION,
!name:length!,
DESCR:ZSYS^VAL^LEN^PROCESSDESCR,
DESCLEN);
Opening Files
Your program must open a file before gaining access to it. Use the FILE_OPEN_
procedure to open any file on your system or network. You supply the procedure with
a file name and the name of a variable in which to return the file number. You will later
use this file number to perform operations on the open file. The association of the file
number with the file name remains until the file is closed.
The FILE_OPEN_ procedure call has many options; only the most common are
described here. For a complete description of all FILE_OPEN_ parameters, refer to
the Guardian Procedure Calls Reference Manual.