2.4 RMS Functions

RMS provides a number of functions that create and manipulate files. These functions use RMS data structures to define the characteristics of a file and its records. The data structures are used as indirect arguments to the function call.

The RMS data structures are grouped into four main categories, as follows:

RMS uses these data structures to perform file and record operations. Table 2-1 lists some of the common functions.

Table 2-1 Common RMS Run-Time Processing Functions

Category  Function  Description 
File Processing  sys$create  Creates and opens a new file of any organization. 
  sys$open  Opens an existing file and initiates file processing. 
  sys$close  Terminates file processing and closes the file. 
  sys$erase  Deletes a file. 
Record Processing  sys$connect  Associates a file access block with a record access block to establish a record access stream; a call to this function is required before any other record-processing function can be used. 
  sys$get  Retrieves a record from a file. 
  sys$put  Writes a new record to a file. 
  sys$update  Rewrites an existing record to a file. 
  sys$delete  Deletes a record from a file. 
  sys$rewind  Positions the record pointer to the first record in the file. 
  sys$disconnect  Disconnects a record access stream. 

All RMS functions are directly accessible from DEC C programs. The syntax for any RMS function has the following form:

int sys$name(struct rms_structure *pointer);

In this syntax, name is the name of the RMS function (such as OPEN or CREATE); rms_structure is the name of the structure being used by the function.

The file-processing functions require a pointer to a file access block as an argument; the record-processing functions require a pointer to a record access block as an argument. Since sys$create is a file-processing function, its syntax is as follows:

int sys$create(struct FAB *fab);

These syntax descriptions do not show all the options available when you invoke an RMS function. For a complete description of the RMS calling sequence, see the OpenVMS Record Management Services Reference Manual.

Finally, all the RMS functions return an integer status value. The format of RMS status values follows the standard format described in Chapter 3. Since RMS functions return a 32-bit integer, you do not need to declare the type of an RMS function return before you use it.


Previous Page | Next Page | Table of Contents | Index