SA_AamReadLast


 

SA_AamReadLast reads the last encountered record that meets the key specification.

int SA_aamReadLast ( SA_FH AamFH, u8 *Buffer, u32 BuffLen,
u8
*KeyString, u32 KeyStringLen );

Parameters:
AamFH
The handle of the previously opened or prepared AAM file.
Buffer
The buffer filled by the operation.
BuffLen
The length of the input buffer {Buffer}.
KeyString
A string of keys delimited by 0x0D characters.
KeyStringLen
The length of {KeyString}.

Note the following:

  1. The buffer length {BufLen} must be equal to or larger than the {RecLen} parameter specified in SA_AamPrep plus one (1) for null termination.

  2. A null buffer pointer will allow positioning to the indicated record without actually reading it.

  3. The {KeyString} specifies a series of one or more keys. Each key is delimited with an 0x0D character.

  4. The format of each key is the two digit key number, the match type letter from the table below, and the text to match.

  5. The key number is established by the ordering of the key list in the SA_AamPrep and begins at one (1).

  6. The matching may be left justified, right justified, exact, or floating (L, R, X, or F respectively).

  7. The text to match must be equal to or less than the length of the target field. Otherwise, it will be truncated before use.

  8. For floating matches, at least three (3) contiguous non blank, non don't care characters must be given if no left, right or exact keys are specified.

  9. If {KeyString} is null, the last record read using the control block will be re-read.

  10. The {KeyString} should not be a stack variable and should not be modified between the SA_AamRead statement and any associated SA_AamReadKG or SA_AamReadKGP statements.

  11. Function return codes are as follows::

  12.  

    Value

    Meaning

    nn

    Length of the data read + 1.

    0

    No more records meeting this key specification.

    -nn

    Error as described in Sunaccess Errors

Example:

 

long fh;

char buffer[1024];

char keys[] = {"01XJohn",0x0D,"02LSmith",0x0D,"03F752"};

 

SA_AamReadLast(fh, &buffer, sizeof (buffer),keys, sizeof(keys));

 



Sunaccess Reference SA_AamReadKGP SA_AamWrite