COBOL statements and national data
You can use national data
with the PROCEDURE
DIVISION
and compiler-directing statements shown in the table
below.
COBOL statement | Can be national | Comment | For more information |
---|---|---|---|
ACCEPT |
identifier-1, identifier-2 | identifier-1 is converted from the code page indicated by the runtime locale only if input is from the terminal. | Assigning input from a screen or file (ACCEPT) |
ADD |
All identifiers can be numeric items
that have USAGE NATIONAL . identifier-3 (GIVING )
can be numeric-edited with USAGE NATIONAL . |
Using COMPUTE and other arithmetic statements | |
CALL |
identifier-2, identifier-3, identifier-4, identifier-5; literal-2, literal-3 | Passing data | |
COMPUTE |
identifier-1 can
be numeric or numeric-edited with USAGE NATIONAL . arithmetic-expression can
contain numeric items that have USAGE NATIONAL . |
Using COMPUTE and other arithmetic statements | |
COPY . . . REPLACING |
operand-1, operand-2 of
the REPLACING phrase |
Compiler-directing statements | |
DISPLAY |
identifier-1 | identifier-1 is converted to the code page associated with the current locale. | Displaying values on a screen or in a file (DISPLAY) |
DIVIDE |
All identifiers can be numeric items
that have USAGE NATIONAL . identifier-3 (GIVING )
and identifier-4 (REMAINDER ) can
be numeric-edited with USAGE NATIONAL . |
Using COMPUTE and other arithmetic statements | |
INITIALIZE |
identifier-1; identifier-2 or literal-1 of
the REPLACING phrase |
If
you specify REPLACING NATIONAL or REPLACING
NATIONAL-EDITED , identifier-2 or literal-1 must
be valid as a sending operand in a move to identifier-1. |
Examples: initializing data items |
INSPECT |
All identifiers and literals. (identifier-2,
the TALLYING integer data item, can have USAGE
NATIONAL .) |
If any of
these (other than identifier-2,
the TALLYING identifier) have USAGE NATIONAL ,
all must be national. |
Tallying and replacing data items (INSPECT) |
MERGE |
Merge keys, if you specify NCOLLSEQ(BIN) |
The COLLATING SEQUENCE phrase
does not apply. |
Setting sort or merge criteria |
MOVE |
Both the sender and receiver, or only the receiver | Implicit
conversions are performed
for valid MOVE operands. |
Assigning values to elementary data items (MOVE) |
MULTIPLY |
All identifiers can be numeric items
that have USAGE NATIONAL . identifier-3 (GIVING )
can be numeric-edited with USAGE NATIONAL . |
Using COMPUTE and other arithmetic statements | |
SEARCH ALL (binary
search) |
Both the key data item and its object of comparison | The key data item and its object of comparison must be compatible according to the rules of comparison. If the object of comparison is of class national, the key must be also. | Doing a binary search (SEARCH ALL) |
SORT |
Sort keys, if you specify NCOLLSEQ(BIN) |
The COLLATING SEQUENCE phrase
does not apply. |
Setting sort or merge criteria |
STRING |
All identifiers and literals. (identifier-4,
the POINTER integer data item, can have USAGE
NATIONAL .) |
If identifier-3,
the receiving data item, is national, all identifiers and literals
(other than identifier-4, the POINTER identifier)
must be national. |
Joining data items (STRING) |
SUBTRACT |
All identifiers can be numeric items
that have USAGE NATIONAL . identifier-3 (GIVING )
can be numeric-edited with USAGE NATIONAL . |
Using COMPUTE and other arithmetic statements | |
UNSTRING |
All identifiers and literals. (identifier-6 and identifier-7,
the COUNT and TALLYING integer data
items, respectively, can have USAGE NATIONAL .) |
If identifier-4,
a receiving data item, has USAGE NATIONAL , the sending
data item and each delimiter must have USAGE NATIONAL ,
and each literal must be national. |
Splitting data items (UNSTRING) |
XML GENERATE |
identifier-1 (the generated XML document); identifier-2 (the source field or fields); identifier-4 or literal-4 (the namespace identifier); identifier-5 or literal-5 (the namespace prefix) | Producing XML output | |
XML PARSE |
identifier-1 (the XML document) | The XML-NTEXT special
register contains national character document fragments during parsing. |
Processing XML input |
Related tasks
Defining numeric data
Displaying numeric data
Using national data (Unicode) in COBOL
Comparing national (UTF-16) data
Defining numeric data
Displaying numeric data
Using national data (Unicode) in COBOL
Comparing national (UTF-16) data
Related references
NCOLLSEQ
Classes and categories of data (COBOL for Linux on x86 Language Reference)
NCOLLSEQ
Classes and categories of data (COBOL for Linux on x86 Language Reference)