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


Basic alphanumeric literals

Basic alphanumeric literals can contain only single-byte characters.

The following is the format for a basic alphanumeric literal:

Format 1: Basic alphanumeric literals

single-byte-characters”
'single-byte-characters'

The enclosing quotation marks or apostrophes are excluded from the literal when the program is compiled.

An embedded quotation mark or apostrophe must be represented by a pair of quotation marks (“”) or a pair of apostrophes (''), respectively, when it is the character used as the opening delimiter. For example:

“THIS ISN”“T WRONG”
'THIS ISN''T WRONG'

The delimiter character used as the opening delimiter for a literal must be used as the closing delimiter for that literal. For example:

'THIS IS RIGHT'
“THIS IS RIGHT”
'THIS IS WRONG“

You can use apostrophes or quotation marks as the literal delimiters independent of the APOST/QUOTE compiler option.

Any punctuation characters included within an alphanumeric literal are part of the value of the literal.

The maximum length of an alphanumeric literal is 160 bytes. The minimum length is 1 byte.

Alphanumeric literals are in the alphanumeric data class and category. (Data classes and categories are described in Classes and categories of data.)

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.


Terms of use | Feedback

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