Literals [ Micro Focus COBOL Language Reference - Additional Topics ] MPE/iX 5.0 Documentation
Micro Focus COBOL Language Reference - Additional Topics
Literals
NCHAR Literals
There is a third type of literalin addition to the nonnumeric and numeric
literals described in the chapter Concepts of the COBOL Language in your
Language Reference, the NCHAR literal.
An NCHAR literal is a character-string delimited at both ends by
quotation marks or apostrophes, the character-string can consist of any
allowable character in the computer's DBCS character set.
Category of NCHAR Literals
All DBCS literals can be used wherever nonnumeric literals can be used,
subject to rules and exceptions given in the appropriate places in this
chapter.
Mixed Literals
DBCS characters can be included in nonnumeric literals. A nonnumeric
literal that includes SBCS and DBCS characters is called a mixed literal.
In such a literal, SBCS characters are represented by SBCS codes and DBCS
characters by DBCS codes. Each space character is represented by the
SBCS code for space.
On output both the SBCS and the DBCS codes are recognized. In operations
within the program the literal is treated as an ordinary nonnumeric
literal. It is the programmer's responsibility to ensure that the two
halves of a DBCS code do not get separated.
A mixed literal is of category alphanumeric, not NCHAR.
Whether quotation marks or apostrophes are used as character-string
delimiters, the presence of that delimiter in a mixed literal can be
represented by two contiguous occurrences. The presence of the character
that is not serving as the delimiter is represented by a single
occurrence. The value of a mixed literal in the object program is the
string of characters itself, except each embedded pair of contiguous
delimiter characters represents a single character.
Figurative Constants
If a figurative constantis used where only an NCHAR literal is allowed
(according to the rules concerning classes and categories given in the
appropriate places in this chapter), it is an NCHAR literal.
Figurative Constant Values
Constant Representation Example NCHAR
Japanese Values
Shift-JIS EUC
ZERO Represents one or more x"824F" x"A3B0"
ZEROS of the double-byte
ZEROES character " 0"
depending on the
context.
SPACE SPACES Represents one or more x"8140" (1) x"A1A1"(1)
of the double-byte
character space from
the computer's set.
HIGH-VALUE Represents one or more x"FFFF" x"FFFF"
HIGH-VALUES character that has the
highest ordinal
position in the
program collating
sequence.
LOW-VALUE Represents one or more x"0000" x"0000"
LOW-VALUES character that has the
lowest ordinal
position in the
program collating
sequence.
QUOTE Represents one or more x"818D"(2) x"A1ED"(2)
QUOTES of the double-byte
character " " ".
(1) This value is sensitive to the DBSPACE directive
(2) This value is sensitive to the APOST directive
MPE/iX 5.0 Documentation