Guardian Programmer's Guide

Table Of Contents
Guardian Programmer’s Guide 421922-014
2 - 1
2
Using the File System
This section reviews the concept of a file and describes some of the common
operations that you can use on a file. This section discusses the different types of files
and describes file-name syntax. It goes on to introduce some techniques for passing
file names to a process before describing how to perform the following tasks:
How to pass a file name to a process using a DEFINE or the startup sequence of
messages
How to create and open files using the FILE_CREATE[LIST]_, FILE_OPEN_, and
PROCESS_CREATE_ procedures
How to read from a file using the READ[X] and READUPDATE[X] procedures and
write to a file using the WRITE[X], WRITEREAD[X], and WRITEUPDATE[X]
procedures
How to get information about files using the FILE_GETINFO[LIST][BYNAME]_
procedures
How to handle file-system errors using the FILE_GETINFO_ procedure
How to close files using the FILE_CLOSE_ procedure
At the end of the section, a sample program performs many of these tasks.
Many references point to more detailed information in this guide and in other manuals.
All of the capabilities of the PROCESS_CREATE_ procedure described in this section
are also available through the PROCESS_LAUNCH_ procedure, although parameters
are passed in a different manner to PROCESS_LAUNCH_. How to use the
PROCESS_LAUNCH_ procedure is explained in Section 16, Creating and Managing
Processes.
File Concepts
Recall from Section 1, Introduction to Guardian Programming, that under the operating
system, the following entities are all treated as files:
Disk files
Devices other than disks, such as terminals, printers, and magnetic tape drives
Processes
Each of these entities is reviewed in the following paragraphs.
Disk Files
Disk files can be SQL files or Enscribe files. You access Enscribe files using the
Enscribe database record manager. You access SQL files using the NonStop SQL