B2X (Binary to Hexadecimal)

Read syntax diagramSkip visual syntax diagram
>>-B2X--(--binary_string--)------------------------------------><

returns a string, in character format, that represents binary_string converted to hexadecimal.

The binary_string is a string of binary (0 or 1) digits. It can be of any length. You can optionally include blanks in binary_string (at four-digit boundaries only, not leading or trailing) to aid readability; they are ignored.

The returned string uses uppercase alphabetics for the values AF, and does not include blanks.

If binary_string is the null string, B2X returns a null string. If the number of binary digits in binary_string is not a multiple of four, then up to three 0 digits are added on the left before the conversion to make a total that is a multiple of four.

Here are some examples:
B2X('11000011')    ->   'C3'
B2X('10111')       ->   '17'
B2X('101')         ->   '5'
B2X('1 1111 0000') ->   '1F0'
You can combine B2X with the functions X2D and X2C to convert a binary number into other forms. For example:
X2D(B2X('10111'))  ->   '23'   /* decimal 23 */

Reference Reference

Feedback


Timestamp icon Last updated: Tuesday, 7 January 2014


http://pic.dhe.ibm.com/infocenter/cicsts/v5r1/topic/com.ibm.cics.rexx.doc//dfhrx/b2x.html