C/C++ Programmer's Guide (G06.27+, H06.03+)

Table Of Contents
Interfacing to Guardian Procedures and OSS
Functions
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
3-3
Calling Guardian Procedures
Calling Guardian Procedures
The syntax of a Guardian procedure call determines whether a parameter is required
or is optional. To call procedures with optional parameters, omit the parameter, but
must include the comma that would follow it. For example:
err = FILENAME_SCAN_ (string,length,count,,,options);
A call to a Guardian procedure usually returns either a return value or a condition code.
Most Guardian procedures fall into one of these two categories, and you can call these
procedures directly from a C or C++ program. Those procedures that return both a
return value and a condition code cannot be called directly from a C or C++ program.
Procedures That Return a Return Value
Example 3-1 on page 3-4 shows a C program that calls the Guardian procedure
FILE_GETINFOBYNAME_ to get information about a Guardian file, which is provided
as an input parameter to the procedure. The procedure returns a return value into
retcode.
Note 1 The integer into which a value is returned, retcode, is declared as a
short integer. This is because the integer data type in Guardian
procedures represents a 16-bit word, while the integer data type in large-
model and wide-model C and C++ programs represents a 32-bit word.
Note 2 You must insert a placeholder comma (,) if you omit optional parameters,
unless you omit them from the end of the list. Omitted optional
parameters contain default values, if default values are defined.