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


Basic national literals

The following are the format and rules for a basic national literal.

Format 1: Basic national literals

N“character-data”
N'character-data'

When the NSYMBOL(NATIONAL) compiler option is in effect, the opening delimiter N“ or N' identifies a national literal. A national literal is of the class and category national.

When the NSYMBOL(DBCS) compiler option is in effect, the opening delimiter N” or N' identifies a DBCS literal, and the rules specified in DBCS literals apply.

N“ or N'
Opening delimiters. The opening delimiter must be coded as single-byte characters. It cannot be split across lines.
” or '
The closing delimiter. The closing delimiter must be coded as a single-byte character. 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.

To include the quotation mark or apostrophe used in the opening delimiter in the content of the literal, specify a pair of quotation marks or apostrophes, respectively. Examples:

N'This literal''s content includes an apostrophe'
N'This literal includes “, which is not used in the opening delimiter'
N”This literal includes “”, which is used in the opening delimiter“
character-data
The source text representation of the content of the national literal. character-data can include any combination of single-byte and multibyte characters represented in the code page in effect for the source code.

DBCS characters in the content of the literal can be delimited by workstation shift-out and shift-in control characters as described for the SOSI compiler option in the COBOL for Windows Programming Guide.

Maximum length
The maximum length of a national literal is 80 character positions, excluding the opening and closing delimiters. If the source content of the literal contains one or more multibyte characters, the maximum length is limited by the available space in Area B of a single source line.

The literal must contain at least one character. Each single-byte character in the literal counts as one character position and each multibyte character in the literal counts as one character position. Workstation shift-in and shift-out delimiters for DBCS characters are not counted.

Continuation rules
When the content of the literal includes multibyte characters, the literal cannot be continued. When the content of the literal does not include multibyte characters, normal continuation rules apply.

The source text representation of character-data is automatically converted to UTF-16 for use at run time (for example, when the literal is moved to or compared with a data item of category national).


Terms of use | Feedback

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