Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: mattHi Keith,
Over the years, the LAE has become stricter about character sets and string encodings, primarily because not doing so could and would lead to subtle data corruption issues.
For LAE 6.x the "string" data type has a definite character set within the system. This can be set for the system using the server property ls.brain.characterSet, the default value for this is windows-1252. The "unicode" type is obviously unicode, and moves between UTF-16 while in memory (Java Strings are UTF-16) and UTF-8 in interim data files. Metadata, i.e. the names of fields, at this time can only be of the "string" character set.
The problem you are encountering is that the data your are extracting and want to store into a string has characters which are not part of the string character set (most likely windows-1252, assuming you haven't changed it).
Now the question is: what to do about it?
First, what is the SQL "cast (CAST (RPALPH AS CHAR(40) CCSID 37) AS RPALPH)" supposed to be doing? From looking at the DB2 docs, it seems that it is encoding it as European EBCDIC (CSSID 37) and then converting it back to the character set defined for RPALPH. (Warning: I'm not a DB2 expert, just reading the doc). Is the purpose of this to simply get the DB2 database to do the illegal character mapping, i.e. convert bad characters to ?'s? If so, then to make it work with the default LAE character set (windows-1252), you would need to use CCSID 1252.
Hopefully this helps,
Matt