HEXBYT: Converting a Decimal Integer to a Character

How to:

The HEXBYT function obtains the ASCII, EBCDIC, or Unicode character equivalent of a decimal integer, depending on your configuration and operating environment. It returns a single alphanumeric character in the ASCII, EBCDIC, or Unicode character set. You can use this function to produce characters that are not on your keyboard, similar to the CTRAN function.

In Unicode configurations, this function uses values in the range:

The display of special characters depends on your software and hardware; not all special characters may appear. For printable ASCII and EBCDIC characters and their integer equivalents see the Character Chart for ASCII and EBCDIC.


Top of page

x
Syntax: How to Convert a Decimal Integer to a Character
HEXBYT(decimal_value, output)

where:

decimal_value
Integer

Is the decimal integer to be converted to a single character. In non-Unicode environments, a value greater than 255 is treated as the remainder of decimal_value divided by 256.

output
Alphanumeric


Example: Converting a Decimal Integer to a Character

HEXBYT converts LAST_INIT_CODE to its character equivalent and stores the result in in a column with the format A1.

HEXBYT(LAST_INIT_CODE, 'A1')

On an ASCII platform, for 83, the result is S.

On ASCII platform, for 74, the result is J.


iWay Software