UCS-2 Format

The Universal Character Set (UCS-2) format is a character string where each character is represented by 2 bytes. This character set can encode the characters for many written languages.

Fields defined as UCS-2 data do not contain shift-out (SO) or shift-in (SI) characters.

The length of a UCS-2 field, in bytes, is two times the number of UCS-2 characters in the field.

The fixed-length UCS-2 format is a character string with a set length where each character is represented by 2 bytes.

For information on the variable-length UCS-2 format, see Variable-Length Character, Graphic and UCS-2 Formats.

You define a UCS-2 field by specifying C in the Data-Type entry of the appropriate specification. You can also define one using the LIKE keyword on the definition specification where the parameter is a UCS-2 field.

The default initialization value for UCS-2 data is X'0020'. The value of *HIVAL is X'FFFF', *LOVAL is X'0000', and the value of *BLANKS is X'0020'. You can specify the initialization value for UCS-2 fields using character, UCS-2 or Graphic values. If the type of the literal is not UCS-2, the compiler will perform an implicit conversion to UCS-2. For example, to initialize a UCS-2 field with the UCS-2 form of 'abc', you can specify INZ('abc'), INZ(%UCS2('abc')) or INZ(U'006100620063').

For more information on the UCS-2 format, see the iSeries Information Center globalization topic.

The following are restrictions on the implementation of UCS-2 data when using the Program Verifier:



[ Top of Page | Previous Page | Next Page | Contents | Index ]