× 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 Wed, 12 Oct 2022 at 16:34, Brad Stone <bvstone@xxxxxxxxx> wrote:

Dcl-S SomeCharVar Varchar(50);
Dcl-S ToBeEncoded Varchar(100) Inz('') CCSID(1208);

SomeCharVar = 'hello db2 summit';
ToBeEncoded = SomeCharVar; //Convert it to 1208

//Encode based on 1208
EXEC SQL SET :ToBeEncoded = SYSTOOLS.BASE64ENCODE(:ToBeEncoded);


When I run it I get SQLCOD 332 and SQLSTATE 57017.

My job is CCSID 37. I've tripled checked that.

I do see in the SQL Precompiler it's creating some temp variables (ie,
SQL_00000x) and they are defined as 65535.

Where would I find a more detailed error text showing what CCSIDs it thinks
it's trying to convert from and to?

Here is a similar program on 7.4 TR4:

dcl-s ch varchar(50);
dcl-s ch1208 varchar(100) ccsid(1208) inz;

ch = 'hello db2 summit';
exec sql set :ch1208 = systools.base64encode(:ch);

My compiler listing shows this:
Line <---------------------- Source
Number ....1....+....2....+....3....+
000100 // Set SQL Parameters
000100 /SET CCSID(*CHAR:*JOBRUNMIX)
000100 // SQL COMMUNICATION AREA
...
001000 D DS
SET
001000 D SQL_00000 1 2B 0 INZ(128)
length of header
001000 D SQL_00001 3 4B 0 INZ(4)
statement number
001000 D SQL_00002 5 8U 0 INZ(0)
invocation mark
001000 D SQL_00003 9 9A INZ('0')
CCSID(*JOBRUNMIX) data is okay
001000 D SQL_00004 10 128A CCSID(*JOBRUNMIX)
end of header
001000 D SQL_00005 129 180A VARYING CCSID(*JOBRUNMIX)
CH
001000 D SQL_00006 181 282A VARYING CCSID(*HEX)
CH1208

dump(a) shows this:
CH CHAR(50) VARYING(2) 'hello db2 summit'
CH1208 CHAR(100) VARYING(2) CCSID(1208)
'iIWTk5ZAhILyQKKklJSJow=='

I'd check that the job/SBMJOB which compiles the RPG is also
CCSID(37), and if it is, brute force it by adding the RPG /SET to set
the CCSID to *JOBRUNMIX.
Note: this is an RPG compiler function, not SQL!
https://www.ibm.com/docs/en/i/7.4?topic=directives-set#cdset

--buck

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.