RPG Team Blog

1 Posts tagged with the ccsid tag
0

The problem

Strange but true: By default, RPG assumes that the CCSID of alphanumeric data is the mixed double-byte + single-byte CCSID that is related to the job CCSID.

This matters when all of the following conditions are met

  1. (very common) the actual job CCSID is a single-byte CCSID such as 37
  2. (quite common) conversions are done between alphanumeric data and UCS-2 data
  3. (rare) the alphanumeric data contains shift characters (x'0E' or x'0F')When the alphanumeric data is being converted to UCS-2, and the CCSID is assumed to be a mixed-byte CCSID, the "shift out" character x'0E' signals that the following data is double byte data; when the "shift in" character x'0F' is encountered, this signals a return to single byte data.

If this data is being converted to Unicode, and the data is not really supposed to be interpreted as mixed-byte data, then the Unicode version of the data will not be correct.

The solution

Code CCSID(*CHAR:*JOBRUN) in the H spec of all your modules.

If you are actually using a mixed JOB CCSID, nothing will change. If you are actually using a single byte CCSID, any conversions involving alphanumeric data containing x'0E' will be correct.

But I never have x'0E' in my single byte alphanumeric data

What never?

Well, hardly ever ...

0 Comments Permalink
Bottom Banner