PURPOSE

CFfindocc, CFfindocc32 - find occurrence of converted value

SYNOPSIS

#include <stdio.h>
#include "fml.h"
FLDOCC
CFfindocc(FBFR *fbfr, FLDID fieldid, char *value, FLDLEN len, int type)
#include "fml32.h"
FLDOCC32
CFfindocc32(FBFR32 *fbfr, FLDID32 fieldid, char *value, FLDLEN32 len,
  int type)

DESCRIPTION

CFfindocc() acts like Ffindocc() but first converts the value from the user-specified type to the type of fieldid. CFfindocc() looks for an occurrence of the specified field in the buffer that matches a user-supplied value, length and type. CFfindocc() returns the occurrence number of the first field that matches. fbfr is a pointer to a fielded buffer. fieldid is a field identifier. value is a pointer to the value being sought. len is the length of the value to be compared to input value if type is carray. type is the data type of the field in value.

CFfindocc32 is used with 32-bit FML.

RETURN VALUES

If the field value is not found or if other errors are detected, -1 is returned and CFfindocc() sets Ferror to indicate the error condition.

ERRORS

Under the following conditions, CFfindocc() fails and sets Ferror to:

[FALIGNERR]
-- fielded buffer not aligned
The buffer does not begin on the proper boundary.
 
[FNOTFLD]
-- buffer not fielded
The buffer is not a fielded buffer or has not been initialized by Finit().
 
[FMALLOC]
-- malloc failed
Allocation of space dynamically using malloc(3) failed when converting from a carray to string.
 
[FEINVAL]
-- invalid argument to function
One of the arguments to the function invoked was invalid, (for example, a NULL value parameter was specified).
 
[FNOTPRES]
-- field not present
A field occurrence is requested but the specified field and/or occurrence was not found in the fielded buffer.
 
[FBADFLD]
-- unknown field number or type
A field identifier is specified which is not valid.
 
[FTYPERR]
-- invalid field type
A field identifier is specified which is not valid.

SEE ALSO

Fintro(3fml),
Ffindocc(3fml)