The BLENGTH function returns the length of a byte string. If the string contains data in a multibyte character set (such as UTF-8), the result is the size in BYTES, not characters.
Category
Byte
Syntax
BLENGTH(byte_string)
Parameter and Description
Parameter | Description |
---|---|
byte_string | This parameter specifies the name of a byte data string. This data string can be a field from a source datastore, a variable or the result of another Function. |
Example
Map the length of source field SRC_FLD1 into target field LEN_FLD1. Assume that the length of the source field is 18.
LEN_FLD1 = BLENGTH (SRC_FLD1)
Returns the value 18 and maps the result to the target field.
Examine the length of source field SRC_FLD1. If the length is less than 5, map it to target field TGT_FLD1 unchanged. Otherwise, map only the first 4 bytes into TGT_FLD1.
if BLENGTH(SRC_FLD1) < '5'
{
TGT_FLD1 = SRC_FLD1
}
else
{
TGT_FLD1 = LEFT(SRC_FLD1, 4)
}