ASCII_CHR

The ASCII_CHR function returns the character that has the ASCII code value that is specified by the argument.

Read syntax diagram
>>-ASCII_CHR(expression)---------------------------------------><

The schema is SYSIBM.

expression
An expression that returns a built-in data type of BIGINT, INTEGER, or SMALLINT.

Start of changeexpression can also be a character string or graphic string data type. The string input is implicitly cast to a numeric value of DECFLOAT(34) which is then assigned to a BIGINT value.End of change

The result of the function is a fixed length character string encoded in the SBCS ASCII CCSID (regardless of the setting of the MIXED option in DSNHDECP). The length of the result is 1. If the value of expression is not in the range of 0 to 255, (0 to 127 if the SBCS ASCII CCSID for this system is CCSID 367) the null value is returned.

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

CHR can be specified as a synonym for ASCII_CHR.

Example: Set :hv with the Euro symbol "€" in CCSID 923:
   SET :hv = ASCII_CHR(164);  -- x'A4'
Set :hv with the Euro symbol "€" in CCSID 1252:
   SET :hv = ASCII_CHR(128);  -- x'80'
In both cases, the "€" is assigned to :hv, but because the Euro symbol is located at different code points for the two CCSIDs, the input value is different.