The BSEARCH [byte search] function examines a byte data string and compares it against a second search data string. If the search data string is found within the data string, Connect CDC (SQData) returns the starting position of the matching bytes within the data string. If no match is found, a value of zero (0) is returned.
Category
Byte
Syntax
BSEARCH(data_string, search_data_string)
Parameters and Descriptions
Parameter | Description |
---|---|
data_string | The source data string in any byte format. The data string can be a field from a source datastore, a variable, a constant or the result of another Function. |
search_data_string | One (1) or more bytes that will be used as the search criteria to examine the data string for a match. Search data strings may be a field/column of a datastore, a literal value or the output of another Function. |
Example 1
Find the position of the value TAN within a source field INPUT_STRING. Assume that the field INPUT_STRING contains the value MUSTANG. Map the result to target field STRING_POS.
STRING_POS = BSEARCH (INPUT_STRING, 'TAN')
Returns the value 4 and maps the result to the target field.
Example 2
Search a literal for the value RED and return the position in which the match first occurs. Map the result to target field STRING_POS.
STRING_POS = BSEARCH ('READY', 'RED')
Returns the value 0, since there source data string did not contain the value 'RED'.