Using national literals
To specify national literals, use the prefix character N
and
compile with the option NSYMBOL(NATIONAL)
.
About this task
You can use either of these notations:
N"character-data"
N'character-data'
If
you compile with the option NSYMBOL(DBCS)
, the literal
prefix character N
specifies a DBCS literal, not
a national literal.
To
specify a national literal as a hexadecimal value, use the prefix NX
.
You can use either of these notations:
NX"hexadecimal-digits"
NX'hexadecimal-digits'
Each of the following MOVE
statements sets
the national data item Y
to the UTF-16 value of the
characters 'AB
':
01 Y pic NN usage national.
. . .
Move NX"00410042" to Y
Move N"AB" to Y
Move "AB" to Y
Do not use alphanumeric hexadecimal literals in contexts
that call for national literals, because such usage is easily misunderstood.
For example, the following statement also results in moving the UTF-16
characters 'AB
' (not the hexadecimal bit pattern C1C2
)
to Y
, where Y
is defined as USAGE
NATIONAL
:
Move X"C1C2" to Y
You cannot use national literals in the SPECIAL-NAMES
paragraph or as program-names. You can use a national literal to
name an object-oriented method in the METHOD-ID
paragraph
or to specify a method-name in an INVOKE
statement.