Hexadecimal notation for alphanumeric literals

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'
X" or X'
The opening delimiter for the hexadecimal notation of an alphanumeric literal.
" or '
The closing delimiter for the hexadecimal notation of an alphanumeric literal. If a quotation mark is used in the opening delimiter, a quotation mark must be used as the closing delimiter. Similarly, if an apostrophe is used in the opening delimiter, an apostrophe must be used as the closing delimiter.

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.

See also Hexadecimal notation for national literals.