$PHEXw. Informat

Converts packed hexadecimal data to character data.

Category: Character

Syntax

$PHEXw.

Syntax Description

w

specifies the number of bytes in the input.

When you use $PHEXw. to read packed hexadecimal data, the length of the variable is the number of bytes that are required to store the resulting character value, not w. In general, a character variable whose length is implicitly defined with $PHEXw. has a length of 2w–1.
Default 2
Range 1–32767

Details

Packed hexadecimal data are like packed decimal data, except that all hexadecimal characters are valid. In packed hexadecimal data, the value of the low-order nibble has no meaning. In packed decimal data, the value of the low-order nibble indicates the sign of the numeric value that the data represent. The $PHEXw. informat returns a character value and treats the value of the sign nibble as if it were X'F', regardless of its actual value.

Comparisons

The PDw.d. informat reads packed decimal data and converts them to numeric data.

Example

input @1 devaddr $phex2.;
Data Line 1
Result
0001111000001111
1E0
1The data line represents two bytes of actual binary data, Each half-byte corresponds to a single hexadecimal character. The equivalent hexadecimal representation for the data line is 1E0F.