DBCS literals

The formats and rules for DBCS literals are listed in this section.

Format for DBCS literals

G"<DBCS-characters>"
G'<DBCS-characters>'
N"<DBCS-characters>"
N'<DBCS-characters>'
G", G', N", or N'
Opening delimiters.

N" and N' identify a DBCS literal when the NSYMBOL(DBCS) compiler option is in effect. They identify a national literal when the NSYMBOL(NATIONAL) compiler option is in effect, and the rules specified in National literals apply.

The opening delimiter must be followed immediately by a shift-out control character.

For literals with opening delimiter N" or N', when embedded quotes or apostrophes are specified as part of DBCS characters in a DBCS literal, a single embedded DBCS quote or apostrophe is represented by two DBCS quotes or apostrophes. If a single embedded DBCS quote or apostrophe is found, an E-level compiler message will be issued and a second embedded DBCS quote or apostrophe will be assumed.

<
Represents the shift-out control character (X'0E')
>
Represents the shift-in control character (X'0F')
" or '
The closing delimiter. If a quotation mark is used in the opening delimiter, a quotation mark must be used as the closing delimiter. Similarly, if an apostrophe is used in the opening delimiter, an apostrophe must be used as the closing delimiter.

The closing delimiter must appear immediately after the shift-in control character.

DBCS-characters
DBCS-characters can be one or more characters in the range of X'00' through X'FF' for either byte. Any value will be accepted in the content of the literal, although whether it is a valid value at run time depends on the CCSID in effect for the CODEPAGE compiler option.
Maximum length
28 characters
Continuation rules
Cannot be continued across lines

Where DBCS literals can be used

DBCS literals can be used in the following places:

  • DATA DIVISION
    • In the VALUE clause of data description entries that define a data item of class DBCS.
    • In the VALUE OF clause of file description entries.
  • PROCEDURE DIVISION
    • In a relation condition when the comparand is a DBCS data item, an elementary data item of class national, a national group item, or an alphanumeric group item
    • As an argument passed BY CONTENT in a CALL statement
    • In the DISPLAY and EVALUATE statements
    • In the following statements:
    • In figurative constant ALL
    • As an argument to the NATIONAL-OF intrinsic function
  • Compiler-directing statements COPY, REPLACE, and TITLE