UNICODE

The UNICODE function returns the Unicode UTF-16 code value of the leftmost character of the argument as an integer.

Read syntax diagram
>>-UNICODE(string-expression)----------------------------------><

The schema is SYSIBM.

string-expression can be of any built-in string data type that is not a LOB.

Start of changeThe argument can also be a numeric data type. The numeric argument is implicitly cast to a VARCHAR data type.End of change

If the argument is ASCII, EBCDIC, or Unicode UTF-8, it is first converted to a Unicode UTF-16 string (CCSID 1200) before the function is executed.

The result of the function is an INTEGER.

The result can be null; if the argument is null, the result is the null value.

Example: The following example returns the Unicode value of Unicode character U+5CF0 as an integer and assigns the value to the host variable hv:

Set :hv = UNICODE('Unicode character U+5CF0');hv is set to an integer with a value '23792'.