Previous Topic: Numeric ConstantsNext Topic: Bit Masks


Hexadecimal Literals

When you need to initialize a field or variable to a hexadecimal value, you can code a hexadecimal literal in the following format:

►►─ X'digits' ────────────────────────────────────────────────────────────────►◄
'digits'

Are a combination of valid hexadecimal digits (0—9, A—F) representing the value of a single byte. You must provide an even number of hexadecimal digits.

Since a hexadecimal literal must be contained on one source line in a Reporting Facility program, the maximum number of bytes to be represented in a single literal is 34.

The following table illustrates uses of hexadecimal literals:

Coded String

Net Length

Resultant Literal

X'00'
X'0123450C'
X'C1C2C3F1F2F3'
X'FFFFFFFF'
X'F1F2F3F4'
X'40C140C240C340C4'
X'4040'
X'F0F0F94BF2F160'
X'505B5C6C7D'
X'0G'
X'000'
'FF'
X00FF

1
4
6
4
5
8
2
7
5
*
*
*
*

low-value
a packed number
ABC123
high-values
1234
A B C D
spaces
009.21-
&$*%:
INVALID
INVALID
INVALID
INVALID

Code hexadecimal literals only on Format 2 DEFINE or MOVE commands.