Previous Topic: $CALC FunctionNext Topic: $COUNT Function


$CHARTOHEX Function

$CHAR‑TO‑HEX is an alphanumeric function that displays non‑printable fields. It returns the hexadecimal value of the specified identifier or literal. If you are using the function to set or move values, the length of the receiving field should be at least twice the size of the sending field to avoid truncation.

This function has the following format:

              {alpha‑expression}
              {numfield       }
$CHAR‑TO‑HEX( {numliteral     } )
              {flag            }
alpha‑expression

Defines an alphanumeric expression.

num‑field

Specifies the numeric field.

num‑literal

Specifies the numeric literal.

flag

Specifies a flag.

For more information about alphanumeric expressions, numeric fields, numeric literals, and flags, see the PDL Language Concepts topic in the "Procedure Definition Language Concepts and Language Elements" chapter.

Note: Hexadecimal representation of fields on the PC can differ from hexadecimal representation on the mainframe. For this reason, results from logical tests based on hexadecimal representation can differ between the PC and the mainframe.

Example

Assume that B = 'ABCD' sets A to 'C1C2C3C4'. If B was defined in working data as a five‑byte field, the value of A would be 'C1C2C3C440'.

SET A = $CHAR‑TO‑HEX(B)