Is anyone actually using the base64decode from RPG and it's working?
Honestly the IBM doc is no help and my other research isn't bring up anything of a working example.
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of (WalzCraft) Jerry Forss
Sent: Tuesday, January 16, 2024 2:36 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: External RE: Base64Decode
I have the response json if anyone wants it to play with.
It's just a test label.
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Hiebert, Chris
Sent: Tuesday, January 16, 2024 2:08 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: External RE: Base64Decode
CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
I get the same result in the SQL tool on V7R5.
Looks like the function systools.base64decode is returning UTF8 data but does not tell SQL that the character field has a CCSID.
So, its returned without a CCSID. 65535.
When I pass the result through hex it returns the 1208 hex values for the string.
HEX( systools.base64decode(…) )
On V7R5, when using just “values BASE64_DECODE(..)”, I’m getting back a BLOB that is appears to be the value UTF8 data as well.
I can’t even pass the value through interpret() to cast it to 1208 because the length is variable.
The only way I can get this to work in RPG is to use CCSID(*HEX) for the receiver variable.
Dcl-s Var1 Varchar(4096) CCSID(1208);
Dcl-s Var2 Varchar(4096) CCSID(1208);
Dcl-s Var3 Varchar(4096) CCSID(*HEX);
Var2 = 'aHR0cHM6Ly93d3cuaWJtLmNvbS9kb2Nz+
L2VuL2kvNy41P3RvcGljPW92ZXJ2aWV3+
LWJhc2U2NGRlY29kZS1zY2FsYXItZnVu+
Y3Rpb24=';
Exec Sql set :var1 = systools.base64decode(:Var2); // SQLSTATE = '57017'
// SQL0332 Character conversion between CCSID 65535 and CCSID 1208 not valid.
Var2 = 'aHR0cHM6Ly93d3cuaWJtLmNvbS9kb2Nz+
L2VuL2kvNy41P3RvcGljPW92ZXJ2aWV3+
LWJhc2U2NGRlY29kZS1zY2FsYXItZnVu+
Y3Rpb24=';
Exec Sql set :Var3 = systools.base64decode(:Var2);
Var2 = 'aHR0cHM6Ly93d3cuaWJtLmNvbS9kb2Nz+
L2VuL2kvNy41P3RvcGljPWZ1bmN0aW9u+
cy1iYXNlNjQtZGVjb2Rl';
Exec Sql set :var1 = base64_decode(:Var2); //SQLSTATE 42806
//SQL0303 Variable VAR1 not compatible or value too long.
Var2 = 'aHR0cHM6Ly93d3cuaWJtLmNvbS9kb2Nz+
L2VuL2kvNy41P3RvcGljPWZ1bmN0aW9u+
cy1iYXNlNjQtZGVjb2Rl';
Exec Sql set :Var3 = BASE64_DECODE(:Var2);
--
Chris Hiebert
Senior Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Jack Woehr via RPG400-L
Sent: Tuesday, January 16, 2024 12:12 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Cc: Jack Woehr <jwoehr@xxxxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: Base64Decode
Weird, I base64 encode a string using base64 in PASE or Linux and then pass
it to systools.base64decode() and I get garbage back.
I wondered if the garbage was EBCDIC, but I tried converting it and no go.
Wonder what's happening here?
--
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.
Subject to Change Notice:
WalzCraft reserves the right to improve designs, and to change specifications without notice.
Confidentiality Notice:
This message and any attachments may contain confidential and privileged information that is protected by law. The information contained herein is transmitted for the sole use of the intended recipient(s) and should "only" pertain to "WalzCraft" company matters. If you are not the intended recipient or designated agent of the recipient of such information, you are hereby notified that any use, dissemination, copying or retention of this email or the information contained herein is strictly prohibited and may subject you to penalties under federal and/or state law. If you received this email in error, please notify the sender immediately and permanently delete this email. Thank You
WalzCraft PO Box 1748 La Crosse, WI, 54602-1748 www.walzcraft.com<
http://www.walzcraft.com> Phone: 1-800-237-1326
--
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.
Subject to Change Notice:
WalzCraft reserves the right to improve designs, and to change specifications without notice.
Confidentiality Notice:
This message and any attachments may contain confidential and privileged information that is protected by law. The information contained herein is transmitted for the sole use of the intended recipient(s) and should "only" pertain to "WalzCraft" company matters. If you are not the intended recipient or designated agent of the recipient of such information, you are hereby notified that any use, dissemination, copying or retention of this email or the information contained herein is strictly prohibited and may subject you to penalties under federal and/or state law. If you received this email in error, please notify the sender immediately and permanently delete this email. Thank You
WalzCraft PO Box 1748 La Crosse, WI, 54602-1748
www.walzcraft.com<
http://www.walzcraft.com> Phone: 1-800-237-1326
As an Amazon Associate we earn from qualifying purchases.