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:
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, the following behavior applies:

  • 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 ( Qty:Item )

    If Qty is x`1234', the result is 1234.

  • BCDTOTEXT ( DiscountAmt )

    If DiscountAmt is x`0123', the result is 0123.

  • BCDTOTEXT ( TotalDollars )

    If Total is x`F123', the result is 123.

Related functions

  • BCDTOHEX
  • BCDTOINT
  • TEXTTOBCD