0001 BCHG(3)
0002 =======
0003 :doctype: manpage
0004
0005
0006 NAME
0007 ----
0008 Bchg - Change (add or update) field occurrance in UBF buffer
0009
0010
0011 SYNOPSIS
0012 --------
0013
0014 #include <ubf.h>
0015
0016 int Bchg (UBFH *'p_ub', BFLDID 'bfldid', BFLDOCC 'occ', char *'buf', BFLDLEN 'len');
0017
0018 Link with '-lubf -lnstd -lm -lpthread'
0019
0020 DESCRIPTION
0021 -----------
0022 Change (add or update) field in UBF buffer. The UBF buffer pointer is passed by
0023 'p_ub', field id in 'bfldid'. 'occ' is occurrence to change. The field value is
0024 passed in 'buf'. The 'len' is used only if 'bfldid' type is *BFLD_CARRAY*, for
0025 which length cannot be detected from passed data. The 'buf' field type must
0026 match the 'bfldid' field type.
0027
0028 If 'occ' is bigger than last existing index+1 in buffer then non existing
0029 occurrences (which are not being set directly by this function) are initialized
0030 with defaults. For numerics it is 0, for *BFLD_CHAR* it is 0x00, for *BFLD_STRING*
0031 it is empty string, for *BFLD_CARRAY* it is empty byte array (with length 0).
0032
0033 For performance reasons, it is recommended to use Bchg over CBchg,
0034 to skip the conversion step.
0035
0036 Bchg() requires double pointer in 'buf' if setting the *BFLD_PTR* field, i.e.
0037 pointer to pointer of XATMI buffer needs to be passed to the function.
0038 In case if using Fchg() or Fchg32() wrappers, 'buf' accepts direct pointer to XATMI
0039 buffer.
0040
0041 RETURN VALUE
0042 ------------
0043 On success, *Bchg()* return zero; on error, -1 is returned, with *Berror* set to
0044 indicate the error.
0045
0046 ERRORS
0047 ------
0048 Note that *Bstrerror()* returns generic error message plus custom message with
0049 debug info from last function call.
0050
0051 *BALIGNERR* Corrupted buffer or pointing to not aligned memory area.
0052
0053 *BNOTFLD* Buffer not fielded, not correctly allocated or corrupted.
0054
0055 *BNOSPACE* No space in buffer for string data.
0056
0057 *BBADFLD* Invalid field id passed.
0058
0059 EXAMPLE
0060 -------
0061 See *ubftest/ubfunit1.c* for sample code.
0062
0063 BUGS
0064 ----
0065 Report bugs to support@mavimax.com
0066
0067 SEE ALSO
0068 --------
0069 *CBchg(3)* *Badd(3)* *CBadd(3)* *Bget(3)* *CBget(3)*
0070
0071 COPYING
0072 -------
0073 (C) Mavimax, Ltd
0074