C2X (Character to Hexadecimal)

The C2X function returns a string, in character format, that represents string converted to hexadecimal.

Read syntax diagramSkip visual syntax diagram C2X( string )
The returned string contains twice as many bytes as the input string. For example, on an EBCDIC system, C2X(1) returns F1 because the EBCDIC representation of the character 1 is 'F1'X.

The string returned uses uppercase alphabetics for the values A-F and does not include blanks. The string can be of any length. If string is null, returns a null string.

Examples

C2X('72s')      ->    'F7F2A2' /* 'C6F7C6F2C1F2'X in EBCDIC */
C2X('0123'X)    ->    '0123'   /* 'F0F1F2F3'X     in EBCDIC */