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. 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.
An alphanumeric literal in hexadecimal notation has data class and category alphanumeric. The compiler converts the hexadecimal notation into the normal characters of an alphanumeric literal. Hexadecimal notation for alphanumeric literals can be used anywhere alphanumeric literals can be used.
Usage note: Use hexadecimal notation to express control characters X'00' through X'1F' within an alphanumeric literal. Results are unpredictable if you specify these control characters in a basic alphanumeric literal.