The B2X function converts a binary value to its hexadecimal equivalent in character format. The numbers of bytes returned by this function are twice the number of bytes of the source binary value, since each source binary digit is translated into two (2) character bytes.
Category
String
Syntax
B2X(string_value, length)
Parameters and Descriptions
Parameter | Description |
---|---|
binary_value | This parameter specifies a source datastore field/column or the numeric binary result of another Function. |
length | A numeric value that specifies the number of characters (bytes) to be returned from the source field. |
Example
Translate a three (3) byte field, BINARY_FIELD, that contains the binary value F0B1CA into its hexadecimal character representation, the length field contains the value 6. It will map it to target field HEXCHAR.
HEXCHAR = B2X (BINARY_FIELD,6 )
Results in the source binary number being converted to a six (6) byte hex character equivalent of the number ('F0B1CA') being mapped to the six (6) byte field HEXCHAR.