× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 2022-10-12 5:23 p.m., Buck Calabro wrote:
On Wed, 12 Oct 2022 at 16:34, Brad Stone <bvstone@xxxxxxxxx> wrote:
...
My compiler listing shows this:
Line <---------------------- Source
Number ....1....+....2....+....3....+
000100 // Set SQL Parameters
000100 /SET CCSID(*CHAR:*JOBRUNMIX)
000100 // SQL COMMUNICATION AREA
...

The RPG compiler has a very strange (aka wrong) default idea about the CCSID of character variables. Instead of defaulting to the job CCSID, they default to the mixed SBCS/DBCS CCSID related to the job CCSID.

If your job CCSID (or your default job CCSID) is 37, RPG assumes a default CCSID of 937 for your character variables. Usually this doesn't matter, but if you have x'0E' in the data, it is interpreted as a shift-out (shifting out of SBCS mode into DBCS mode). DBCS mode ends with the shift-out x'0F'.

To tell RPG to assume that character variables default to the actual job CCSID, code Control keyword CCSID(*CHAR:*JOBRUN).

The SQL precompiler adds that /SET directive to ensure that the variables it defines will have the same default as the RPG variables.

If you have CCSID(*CHAR:*JOBRUN), then the SQL precompiler will code that in its /SET directive too.

I think it's a good idea to always code CCSID(*CHAR:*JOBRUN) in the control statements.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.