SA_AamOpen


 

A file must be created or opened prior to any attempt to process data against it. SA_AamOpen opens the indicated aamdex file and the text file associated with it.

SA_FH SA_AamOpen ( char *AamName, u32 AamNameLen, char DontCare, u32 OpenMode);

Parameters:
AamName
The file name of the AAM file to open.
AamNameLen
The length of the AAM file name.
DontCare
The universal matching character for searches.
OpenMode
A valid file access mode.

Note the following:

  1. Upon success of the function, the open file handle is returned.

  2. The text file name is retrieved from the header sector of the AAM file.

  3. There is no implied close of an open file. If a file is opened and the file handle is used again in a subsequent open or prepare, the first file will remain open for the duration of the program.

  4. {DontCare}, if specified, re-defines the universal matching character for searches. A null character or null string pointer leaves the universal matching character as set by SA_AamPrep or as default ("?").

  5. Function return codes are as follows:

  6.  

    Value

    Meaning

    +nn

    Success (file handle).

    -nn

    Error as described in Sunaccess Errors

 

Example 1 - Local file open:

 

if ((fh = SA_AamOpen("mastf8mr.aam", 12, '?', SA_SHARE)) < 0)

     {

     printf("Open error code = %d", fh );

     exit(1);

     }

Example 2 - Managed file open:

 

if ((fh = SA_AamOpen("mastf8mr.aam|64.246.11.321", 26, '?', SA_SHARE)) < 0)

     {

     printf("Open error code = %d", fh );

     exit(1);

     }

 

where "64.246.11.321" is the IP number of the Sunbelt Data Manager. Optionally, the user can use a Managed File Descriptor to open the file:

 

if ((fh = SA_AamOpen("mastf8mr.mfd", 12, '?', SA_SHARE)) < 0)

     {

     printf("Open error code = %d", fh );

     exit(1);

     }

 

The MFD is created using the Sunbelt "makemfd" utility and specifies the location of the server and other parameters.



Sunaccess Reference SA_AamPrep SA_AamClose