HP 3000 Manuals

Procedure Division [ Micro Focus COBOL Language Reference - Additional Topics ] MPE/iX 5.0 Documentation


Micro Focus COBOL Language Reference - Additional Topics

Procedure Division 

Conditional Expressions 

Condition-name.   

If a condition-name with a literal of class NCHAR is associated with an
elementary item which is not of class NCHAR, the literal is treated as an
SBCS alphanumeric literal.

Relation Conditions.   

Data items and literals of class NCHAR can be used in a relation
conditionwith any relational operator.  No conversion, editing or
de-editing is done and no distinction is made between items of category
NCHAR and items of category NCHAR-EDITED.

The operation performed is a nonnumeric comparison.  Since there is in
general no collating sequence between the characters in a DBCS character
set, the collating sequence used is based on the numeric values of the
bit patterns representing the characters, interpreted as if they were
binary numbers.

Note that if the DBCS character codes include codes for characters in the
SBCS character set, there is no guarantee that this collating sequence
orders them the same as in SBCS.

Where a character exists in both the DBCS and SBCS character sets, its
DBCS and SBCS representations are not regarded as equivalent.

The PROGRAM COLLATING SEQUENCE clause has no effect on comparisons
involving data items of class NCHAR or NCHAR literals.

If the operands are of unequal size, comparison proceeds as though the
shorter operand were extended on the right by enough DBCS spaces to make
them the same size.

Class Condition.   

An additional classtest, JAPANESE, is available.  This class test is true
if all characters in the data item being tested are valid single-byte
Katakana or double-byte characters, or if the data item contains all
spaces.

The ACCEPT Statement 

General Rule.   

In Format 1, both SBCS and DBCS data can be entered.  SBCS data is not
converted to DBCS data.

If a Format 1 ACCEPTof an NCHAR-EDITED data item, there is no validation,
conversion or character alignment of the data that you enter.  As a
result, the data might be corrupted.  Therefore, we recommend that you do
not use this method, or use it with caution.

In Formats 4 and 5, both single-byte and double-byte characters are valid
characters to be entered into an NCHAR data item.  However single-byte
characters are converted to their double-byte equivalent.

All normal editing features are supported for the ACCEPT of NCHAR data
items (backspace, retype, delete, restore, overtype and insert) on a
character by character basis.


NOTE In some environments, such as a Japanese EUC environment, special actions or behavior may occur. For further details of these directives see your COBOL System Reference.
The INITIALIZE Statement General Format. The General Formatis extended by the options NCHAR and JAPANESE as additional alternatives to options such as ALPHABETIC or ALPHANUMERIC. Syntax Rule. NCHAR and JAPANESE may not be specified together or in conjunction with DBCS or NATIONAL. General Rule. Specifying the NCHAR or JAPANESE option causes data items of category NCHAR to be initialized. The INSPECT Statement General Rule. Ifidentifier-1 is of class NCHAR, the count maintained in identifier-2 is of DBCS characters, not bytes. Syntax Rule. All the identifiers and literals except identifier-2 must be of class NCHAR if any one of them is of class NCHAR. The MOVE Statement All statements that involve moving data between items and/or literals of class NCHAR obey the rules given for such moves under the General Rules for The MOVEStatement later in this chapter.
[]

NOTE Class Alphanumeric is specified in this table as an illustration of the usage of single-byte or group data items. For details of MOVE operations involving only single-byte data items refer to the MOVE statement in the chapter Program Definition in your Language Reference. For details of MOVE operations mixing single- and double-byte data item, refer to the following information and the table above.
Syntax Rules. 1. The sending data item must not be of category NCHAR-EDITED. 2. If the receiving data item is of class NCHAR and the JUSTIFIED clause is specified, the sending data item must be of class NCHAR. General Rules. 1. If the sending data item is of class alphanumeric or alphabetic and the receiving data item is of class NCHAR then the single-byte characters in the source are converted into the equivalent double-byte characters in the target. DBCS characters in the source are moved unchanged into the target. If a receiving data item is a different size from the sending data item, the data that is stored in the receiving item is truncated or padded on the right with DBCS spaces. 2. If the sending data item is of class NCHAR and the receiving data item is of class alphanumeric, then the hexadecimal values in the source are moved, unchanged, to the target data item on a byte by byte basis. If a receiving data item is a different size from the sending data item, the data that is stored in the receiving item is truncated or padded on the right with SBCS spaces. 3. If the sending data item is of class NCHAR and the receiving data item is also of class NCHAR, then the values in the source are moved, unchanged, to the target data item on a byte by byte basis. If a receiving data item is a different size from the sending data item, the data that is stored in the receiving item is truncated or padded on the right with DBCS spaces. 4. If the sending data item is of class alphanumeric, alphabetic or NCHAR and a receiving data item is of category NCHAR-EDITED, editing is carried out on that receiving data item. If a receiving data item is a different size from the sending data item, the data is stored in that receiving item and truncated or padded on the right with DBCS spaces. If the sending data item is of class alphanumeric or alphabetic, the hexadecimal values of the single-byte characters in the source are converted to the equivalent double-byte characters in the target. DBCS characters in the source are moved unchanged into the target. 5. If the sending data item is of class NCHAR and the receiving data item is class NCHAR with the JUSTIFIED clause specified, then the values in the source data item are moved, unchanged, to the target data item on a byte by byte basis. When a receiving data item is described with JUSTIFIED clause and the sending data item is larger than the receiving data item, the leftmost characters are truncated. When the receiving data item is described with the JUSTIFIED clause and it is larger than the sending data item, data is aligned at the rightmost character position in the data item with DBCS spaces padding from the leftmost character positions. The SEARCH Statement General Rule. If identifier-1 is of classNCHAR then in Format 1 the value maintained in identifier-2 consists of DBCS characters. The STRING Statement General Rule. If identifier-3 is of classNCHAR then the relative position indicated by identifier-4 gives the position in DBCS characters. Syntax Rule. All the identifiers and literals except identifier-4 must be of class NCHAR if any one of them is of class NCHAR. The UNSTRING Statement General Rule. If identifier-1 is of class NCHARthen the relative position indicated by identifier-7 gives the position in DBCS characters and the count maintained in identifier-6 is of DBCS characters. Syntax Rule. All of identifier-1, identifier-2, identifier-3, literal-1 and literal-2 must be of class NCHAR if any one of them is of class NCHAR.


MPE/iX 5.0 Documentation