Nonnumeric Literals

A nonnumeric literal (sometimes called an alphanumeric literal) is a character string delimited at the beginning and at the end by quotation marks or apostrophes. The beginning and ending delimiters must be the same (that is, either both quotes or both apostrophes).

Nonnumeric literals may be up to 4096 characters in length. The characters contained in the delimiters may be selected from all characters available on the host computer.

To place the delimiter character in a nonnumeric literal, use two contiguous delimiter characters (either two quotes or two apostrophes). These two characters represent a single occurrence of that character.

You can also specify nonnumeric literals by supplying the hexadecimal value of the characters desired using the native character set. This can be used, for example, to encode device control codes. Any of the following formats are recognized:

X"hex-values"
X'hex-values'
H"hex-values"
H'hex-values'

The initial H or X may be either upper- or lower-case. The hex-values consist of one or more hexadecimal digits. These digits are drawn from the set of characters '0' – '9' and 'A' – 'F'. Every two hexadecimal digits represent one character position, with the first digit encoding the high-order 4 bits of the character, and the second digit encoding the low-order 4 bits. If an odd number of hexadecimal digits is specified, the low-order 4 bits of the last character are treated as zeros.

Note: In ACUCOBOL-GT h"123" is a nonnumeric literal and not numeric literal for all other dialects.

Example:

The following pairs of nonnumeric literals are equivalent (when the native character set is ASCII):

X"414243"     "ABC"
h'32313' "210"
H"6E" "n"
x"22" """"