BEA Logo BEA Tuxedo Release 7.1

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy


   Tuxedo Doc Home   |   Reference   |   Topic List   |   Previous   |   Next   |   Contents

   BEA Tuxedo FML Function Reference

Ffindocc, Ffindocc32(3fml)


Ffindocc(), Ffindocc32() - find occurrence of field value


#include <stdio.h>  
#include "fml.h"
Ffindocc(FBFR *fbfr, FLDID fieldid, char *value, FLDLEN len) #include "fml32.h"
Ffindocc32(FBFR32 *fbfr, FLDID32 fieldid, char *value, FLDLEN32 len)


Ffindocc() looks at occurrences of the specified field in the buffer and returns the occurrence number of the first field occurrence that matches the user specified field value. fbfr is a pointer to a fielded buffer. fieldid is a field identifier. The value to be found is contained in the location pointed to by the value parameter. len is the length of the value if its type is FLD_CARRAY. If fieldid is field type FLD_STRING and if len is not 0, pattern matching is done on the string. The pattern match supported is the same as the patterns described in regcmp(3) (in UNIX reference manuals). In addition, the alternation of regular expressions is supported (for example, ''A|B'' matches with ''A'' or ''B''). The pattern must match the entire field value (that is, the pattern ''value'' is implicitly treated as ''^value$''). The version of Ffindocc() provided for use in the MS-DOS and OS/2 environments does not support the regcmp() pattern matching for FLD_STRING fields; it uses strcmp() (in UNIX reference manuals).

In the "Synopsis" section above the value argument to Ffindocc() is described as a character pointer data type (char * in C). Technically, this describes only one particular kind of value passable to Ffindocc(). In fact, the type of the value argument should be a pointer to an object of the same type as the type of the fielded-buffer representation of the field being found. For example, if the field is stored in the buffer as type FLD_LONG, then value should be of type pointer-to-long (long * in C). Similarly, if the field is stored as FLD_SHORT, then value should be of type pointer-to-short (short * in C). The important thing is that Ffindocc() assumes that the object pointed to by value has the same type as the stored type of the field being found.

For values of type FLD_PTR, Ffindocc32() finds the occurrence of a field that matches a specified pointer value. For values of type FLD_FML32, two fields are considered equal if all field occurrences and values are equal. For values of type FLD_VIEW32, two fields are considered equal if the view names are the same, and if all structure member occurrences and values are equal.

Ffindocc32() is used with 32-bit FML.

A thread in a multithreaded application may issue a call to Ffindocc() or Ffindocc32() while running in any context state, including TPINVALIDCONTEXT.

Return Values

This function returns -1 on error and sets Ferror to indicate the error condition.


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


"fielded buffer not aligned"
The buffer does not begin on the proper boundary.


"buffer not fielded"
The buffer is not a fielded buffer or has not been initialized by Finit().


"field not present"
A field value is requested but the specified field and/or value was not found in the fielded buffer.


"invalid argument to function"
One of the arguments to the function invoked was invalid (for example, passing a NULL value parameter to Ffindocc() or specifying an invalid string pattern).


"unknown field number or type"
A field identifier is specified which is not valid.

See Also

Introduction to FML Functions, Ffind, Ffind32(3fml), Ffindlast, Ffindlast32(3fml), Ffinds, Ffinds32(3fml)

regcmp(3) in a UNIX system reference manual