Basic national literals
The format and rules for basic national literals are listed in this section.
Format 1: Basic national literals |
---|
|
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"
orN'
- 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 EBCDIC single-byte characters and
double-byte characters encoded in the Coded Character Set ID (CCSID)
specified by the CODEPAGE compiler option.
DBCS characters in the content of the literal must be delimited by shift-out and shift-in control characters.
- 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 DBCS 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 DBCS character in the literal counts as one character position. Shift-in and shift-out delimiters for DBCS characters are not counted.
- Continuation rules
- When the content of the literal includes DBCS characters, the literal cannot be continued. When the content of the literal does not include DBCS 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).