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:
H CSSID(*GRAPH: *SRC)
the second parameter *SRC will not be substituted as the Program Verifier
cannot always retrieve the source CCSID, especially when the source is residing
on the workstation or we do not have a connection to the host. The Program
verifier will issue a warning message indicating that the *SRC has not been
substituted.
H CCSID(*GRAPH: *SRC)
D grafld1 S 10G
D grafld2 S 10G ccsid(300)
C if grafld1 = grafld2
C endif
Since the *SRC is not substituted,
an error message will be issued on program verification indicating that fields
with different CCSIDs are not allowed in the same operation. While on the
host, if *SRC is 300 then no error message is issued. D grafld2 S 10G inz(%ucs2(u'aabbcc'))
The Program Verifier will issue a warning message indicating that the
%UCS2 is not evaluated and any errors resulting from the evaluation will not
be reported.