Alphanumeric literals with DBCS characters

When the DBCS compiler option is in effect, the characters X'0E' and X'0F' in an alphanumeric literal will be recognized as shift codes for DBCS characters. That is, the characters between paired shift codes will be recognized as DBCS characters. Unlike an alphanumeric literal compiled under the NODBCS option, additional syntax rules apply to DBCS characters in an alphanumeric literal.

Alphanumeric literals with DBCS characters have the following format:

Format 2: Alphanumeric literals with DBCS characters

"mixed-SBCS-and-DBCS-characters"
'mixed-SBCS-and-DBCS-characters'
" or '
The opening and closing delimiter. The closing delimiter must match the opening delimiter.
mixed-SBCS-and-DBCS-characters
Any mix of single-byte and DBCS characters.

Shift-out and shift-in control characters are part of the literal and must be paired. They must contain zero or an even number of intervening bytes.

Nested shift codes are not allowed in the DBCS portion of the literal.

The syntax rules for single-byte characters in the literal follow the rules for basic alphanumeric literals. The syntax rules for DBCS characters in the literal follow the rules for DBCS literals.

The move and comparison rules for alphanumeric literals with DBCS characters are the same as those for any alphanumeric literal.

The length of an alphanumeric literal with DBCS characters is its byte length, including the shift control characters. The maximum length is limited by the available space on one line in Area B. An alphanumeric literal with DBCS characters cannot be continued.

An alphanumeric literal with DBCS characters is of the alphanumeric category.

Alphanumeric literals with DBCS characters cannot be used:

  • As a literal in the following cases:
    • ALPHABET clause
    • ASSIGN clause
    • CALL statement program-ID
    • CANCEL statement
    • CLASS clause
    • CURRENCY SIGN clause
    • END PROGRAM marker
    • ENTRY statement
    • PADDING CHARACTER clause
    • PROGRAM-ID paragraph
    • RERUN clause
    • STOP statement
    • XML-SCHEMA clause
  • As the external class-name for an object-oriented class
  • As the basis-name in a BASIS statement
  • As the text-name in a COPY statement
  • As the library-name in a COPY statement

Enterprise COBOL statements process alphanumeric literals with DBCS characters without sensitivity to the shift codes and character codes. The use of statements that operate on a byte-to-byte basis (for example, STRING and UNSTRING) can result in strings that are not valid mixtures of single-byte EBCDIC and DBCS characters. See Processing alphanumeric data items that contain DBCS data in the Enterprise COBOL Programming Guide for more information about using alphanumeric literals and data items with DBCS characters in statements that operate on a byte-by-byte basis.