Data Transformation Engine Functions and Expressions Reference Guide
Chapter 3 - Function Reference BCDTOTEXT
Functions and Expressions Reference Guide
70
BCDTOTEXT
The BCDTOTEXT function converts the digits in a BCD (Binary Coded Decimal) item
to a text item containing the digits of the BCD-encoded item as a string of
characters.
Syntax
BCDTOTEXT (single-text-expression)
Meaning
BCDTOTEXT (BCD_item_to_convert)
Returns
This function returns a single-text-item.
BCD_item_to_convert is converted from BCD format to a text string containing
the digits of the BCD-encoded value as a string of characters.
Numbers in BCD format have two decimal digits in each byte. Each half-byte,
therefore, can contain a binary value from 0000 (which represents the digit 0)
through 1001, which represents the digit 9). Based on this definition,
! If any half-byte of the BCD number contains the binary value 1101 or 1111,
that half-byte is ignored.
! If the BCD item contains the binary value 1010, 1011, 1100, or 1110, the
output of the function is NONE.
Examples
BCDTOTEXT ( Quantity:Item )
If Qty is x‘1234’, this results in 1234.
BCDTOTEXT ( DiscountAmt )
If DiscountAmt is x‘0123’, this results in 0123.
BCDTOTEXT ( TotalDollars )
If Total is x‘F123’, this results in 123.