SA_AamPrep


 

A file must be created or opened prior to any attempt to process data against it. SA_AamPrep creates a new data file and associated aamdex file.

SA_FH SA_AamPrep ( char *TxtName, u32 *TxtNameLen, char *AamName,
u32 AamNameLen, u32 RecLen, char *OptKeyList,
u32
OptKeyListLength, u32 OpenMode );

Parameters:
TxtName
The file name of the text file to prepare.
TxtNameLen
The length of the {TxtName} string.
AamName
The file name of the AAM file to prepare.
AamNameLen
The length of the {AamName} string.
RecLen
The maximum length of records to be written.
OptKeyList
A character string separated by commas or spaces defining options applied to text file followed by a list of key fields.
OptKeyListLength
The length of the {OptKeyList}.
OpenMode
A valid file access mode.

Note the following:

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

  2. If either the specified data or the AAM file exists, they will be deleted prior to creating the new files.

  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. The maximum record length supported is:

    32,767 - 1 - sizeLEOR

  5. Valid options in {OptKeyList} are:

  6.  

    Option

    Meaning

    D=c

    Specifies the universal matching character {c} for SA_AamRead operations.

    U

    Specifies non-case sensitive searches.

    W

    Write at end of file.

    P

    Primary key specification of the form: Pn=string or Pn#string where n is starting record position and string is up to 8 characters providing the primary record selection (=) or rejection (#) criteria.

     

  7. The {OptKeyList} field list form is:

    key1start-key1end,...,keyNstart-keyNend

  8. To exclude a key field from the AAM file yet still allow searches on the field, prefix start-key with an X as follows:

    "D=#,U,1-24,73,97,X129-152"

  9. Single character keys are allowable.

  10. Function return codes are as follows:

  11.  

    Code

    Meaning

    +nn

    Success (file handle);

    -nn

    Error as described in Sunaccess Errors

     

     



Sunaccess Reference SA_AamOpen