Data Items [ Micro Focus COBOL Language Reference - Additional Topics ] MPE/iX 5.0 Documentation
Micro Focus COBOL Language Reference - Additional Topics
Data Items
NCHAR Data Items
There is a class of dataadditional to the classes described in the
chapter Concepts of the COBOL Language in your Language Reference:
NCHAR. It includes two data categories: NCHAR and NCHAR-EDITED.
A data item of class NCHAR can be described by using the USAGE NCHAR or
USAGE JAPANESE clause. An item with this clause can have only the
characters "N", "B", "/" or "0" in its PICTURE character-string.
An item whose PICTURE character-string is all "N"s is of category NCHAR,
an item whose PICTURE character-string contains both "N" and "B", "/" or
"0" is of category NCHAR-EDITED.
Note that each "N", "B", "/" or "0" represents one 2-byte character
position. Except where otherwise stated, the length of the data item for
all purposes is the number of "N"s, "B"s, "/"s and "0"s in its PICTURE
character-string.
For reference modification, the leftmost-character-position and length
specify the number of DBCS characters, not bytes.
Data items of class NCHAR can be used wherever data items of class
alphanumeric can be used, subject to rules and exceptions given in the
appropriate places in this chapter.
Mixed Data
DBCS characters can be included in datastored in data items of category
alphanumeric. In such data, SBCS characters are represented by SBCS
codes and DBCS characters by DBCS codes. Each space character is
represented by the SBCS code for space.
In operations within the program the data are treated as ordinary
alphanumeric data. It is the programmer's responsibility to ensure that
the two halves of a DBCS code do not get separated.
The length of the data item for all purposes is its length in bytes when
stored in machine memory.
MPE/iX 5.0 Documentation