Rational Developer for System z
COBOL for Windows, Version 7.5, Language Reference


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, it must be used as the closing delimiter. Similarly, if an apostrophe is used in the opening delimiter, it 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. 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.

See also Hexadecimal notation for national literals.


Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)