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.
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“
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.
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.
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).