Using DBCS literals

You can use the prefix N or G to represent a DBCS literal.

About this task

That is, you can specify a DBCS literal in either of these ways:

  • N'dbcs characters' (provided that the compiler option NSYMBOL(DBCS) is in effect)
  • G'dbcs characters'

You can use quotation marks (") or apostrophes (') as the delimiters of a DBCS literal irrespective of the setting of the APOST or QUOTE compiler option. You must code the same opening and closing delimiter for a DBCS literal.

If the SOSI compiler option is in effect, the shift-out (SO) control character X'1E' must immediately follow the opening delimiter, and the shift-in (SI) control character X'1F' must immediately precede the closing delimiter.

In addition to DBCS literals, you can use alphanumeric literals to specify any character in one of the supported code pages. However, if the SOSI compiler option is in effect, any string of DBCS characters that is within an alphanumeric literal must be delimited by the SO and SI characters.

You cannot continue an alphanumeric literal that contains multibyte characters. The length of a DBCS literal is likewise limited by the available space in Area B on a single source line. The maximum length of a DBCS literal is thus 28 double-byte characters.

An alphanumeric literal that contains multibyte characters is processed byte by byte, that is, with semantics appropriate for single-byte characters, except when it is converted explicitly or implicitly to national data representation, as for example in an assignment to or comparison with a national data item.

Related references  
NSYMBOL   
SOSI
  
DBCS literals (COBOL for Linux on x86 Language Reference)