× 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.



Interesting.. I have:

D SQL_00004 10 128A CCSID(*JOBRUNMIX)
D SQL_00005 129 230A VARYING CCSID(*HEX)
D SQL_00006 231 332A VARYING CCSID(*HEX)

I've never used the /set directive before... and there is no CCSID option
on the CRTSQLRPGI command that I can find... SBMJOB CCSID is set to
*CURRENT and I know my job CCSID is 37 as is QCCSID System value.

On Wed, Oct 12, 2022 at 4:24 PM Buck Calabro <kc2hiz@xxxxxxxxx> wrote:

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
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


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.