The TOASCII() built-in function returns the data from parameter 1 after converting it to UTF-8/ASCII (to ccsid 1208).
The E2E() (ebcdic to ascii) built-in function does the same thing.
The TOASCII() translates the data in the first parameter to CCSID 1208 using the iconv API.
select LSTNAM,CITY,STATE INTO &Name, &City, &State from qiws.qcustcdt where cusnum = 192837; eval &a_Name = toascii(&name); eval &a_City = toascii(&city); eval &a_state = toascii(&state); #msg Data in Job CCSID: &Name, &City, &State #msg Data in ASCII/UTF8: &a_Name, &a_City, &a_State
The output from the above script is:
Data in Job CCSID: Lee, Hector, NY Data in ASCII/UTF8: <ÁÁ, çÁÄÈ?Ê, +ß
To show the values in hex:
Data in Job CCSID: 'D38585' 'C88583A39699' 'D5E8' Data in ASCII/UTF8: '4C6565' '486563746F72' '816DD5E8'