Guardian Programmer's Guide

Table Of Contents
Guardian Programmer’s Guide 421922-014
5 - 1
5
Communicating With Disk Files
Data files are typically either NonStop SQL files or files managed by the Enscribe
database record manager. This section discusses Enscribe files. For details of
NonStop SQL file management, see the NonStop SQL manuals.
In this section, you will learn about each file type supported by the Enscribe software
and how to access such files using Guardian procedure calls. Specifically, this section
covers the following topics:
How to use unstructured files
How to use structured files, including relative files, entry-sequenced files, and key-
sequenced files
How to use partitioned files
For each type of file, this section outlines the common file-system operations: create,
open, position, read and write, lock, rename, close, purge, and alter attributes.
Emphasis is given to differences among the file types.
This section does not attempt a comprehensive description of Enscribe files; rather, it
outlines the major features and programmatic operations affecting Enscribe files and
provides examples. Refer to the Enscribe Programmer’s Guide for complete details.
Many of the programmatic tasks described in this section can also be done
interactively using the File Utility Program (FUP); refer to the File Utility Program (FUP)
Reference Manual for details.
Accessing Enscribe files through the NonStop Transaction Manager/MP (TM/MP) is
not discussed here. You should refer to the NonStop TM/MP Application
Programmers Guide for details.
Types of Disk Files
The Enscribe database record manager supports structured and unstructured files.
Structured files contain data and control information that allows each data record to be
uniquely identified. Unstructured files contain only data; access to data is done using a
byte address within the file.
Unstructured Files
The Enscribe database record manager imposes no structure on an unstructured file.
Any structure that such a file has is imposed by the application.
The application can access arbitrary portions of the file by setting the record pointers to
the desired starting byte positions. The current-record pointer addresses the current
record, and the next-record pointer addresses the record that physically follows the
current record. This type of file is therefore suitable for sequential access. To
randomly access records in an unstructured file, you need to set up the pointers with
the byte address of the start of the desired record, relative to the beginning of the file.