Hexadecimal notation can be used for alphanumeric literals. Hexadecimal notation has the following format:
| Format 3: Hexadecimal notation for alphanumeric literals |
|---|
X"hexadecimal-digits" X'hexadecimal-digits' |
Hexadecimal digits are characters in the range '0' to '9', 'a' to 'f', and 'A' to 'F', inclusive. Two hexadecimal digits represent one character in a single-byte character set (EBCDIC or ASCII). Four hexadecimal digits represent one character in a DBCS character set. A string of EBCDIC DBCS characters represented in hexadecimal notation must be preceded by the hexadecimal representation of a shift-out control character (X'0E') and followed by the hexadecimal representation of a shift-in control character (X'0F'). An even number of hexadecimal digits must be specified. The maximum length of a hexadecimal literal is 320 hexadecimal digits.
The continuation rules are the same as those for any alphanumeric literal. The opening delimiter (X" or X') cannot be split across lines.
The DBCS compiler option has no effect on the processing of hexadecimal notation of alphanumeric literals.
An alphanumeric literal in hexadecimal notation has data class and category alphanumeric. Hexadecimal notation for alphanumeric literals can be used anywhere alphanumeric literals can be used.