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



Maria,

Thank you!

So changing my DECODED variable to CCSID(*UTF8) allowed me to write the data to an IFS file and see that it was correct. But I couldn't "see" data in the variable DECODED while in debug?

Ultimately, I need to send this directly to a Zebra Label printer (decoded data is ZPL II). So I'm not sure if I want to write it to the IFS then send it to the printer, or just send it directly to the printer. It might be useful to have a copy of the data (for a period of time) in case printing the label fails for some reason.

Greg

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Maria Lucia Stoppa
Sent: Monday, July 20, 2020 11:15 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Base64 decode

Hi all,
I had the same need, so at first, I tried SQL native function. For some
reason that I couldn't explain, when I had to end the job (a batch job) it
took ages (literally, more than 10 minutes) to end. Then I tried SK
routines.
That's how I am successfully using it:

dcl-s b64EncodedVar char(64);
dcl-s b64DecodedVarUtf8 char(64) ccsid(1208); // utf-8
dcl-s b64DecodedVarLen uns(10);
dcl-s userName char(20);

docNode = YAJL_string_load_tree(requestData.data: errMsg);
if errMsg = '';
node = YAJL_object_find(docNode : 'username');
b64EncodedVar = YAJL_get_string(node);
b64DecodedVarLen = base64_decode(
%addr(b64EncodedVar)
: %len(%trim(b64EncodedVar))
: %addr(b64DecodedVarUtf8)
: %size(b64DecodedVarUtf8)
);
username = %subst(b64DecodedVarUtf8: 1: b64DecodedVarLen);
endif;

Hope it helps.



Il giorno lun 20 lug 2020 alle ore 16:58 Raul Alberto Jager Weiler <
raul.jager@xxxxxxxxx> ha scritto:

SQL has a nice function, It is there, native.

On Mon, Jul 20, 2020 at 10:54 AM Kevin Bucknum <Kevin@xxxxxxxxxxxxxxxxxxx>
wrote:

Don't know if it will help or not, but I put my little testing program
from when I first stated using the decode routines on code.midrange.com
https://code.midrange.com/d49b242563.html

On Mon, 2020-07-20 at 14:25 +0000, Greg Wilburn wrote:

I tried that... I couldn't get it to work. But I may not have defined my
RPG variables correctly.


Do I define them with specific CCSIDs?


-----Original Message-----

From: RPG400-L [mailto:

<mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx>

rpg400-l-bounces@xxxxxxxxxxxxxxxxxx

] On Behalf Of Raul Alberto Jager Weiler

Sent: Monday, July 20, 2020 10:14 AM

To: RPG programming on IBM i <

<mailto:rpg400-l@xxxxxxxxxxxxxxxxxx>

rpg400-l@xxxxxxxxxxxxxxxxxx



Subject: Re: Base64 decode


You can use SQL



On Mon, Jul 20, 2020 at 9:52 AM Greg Wilburn <

<mailto:gwilburn@xxxxxxxxxxxxxxxxxxxxxxx>

gwilburn@xxxxxxxxxxxxxxxxxxxxxxx

wrote:


It's been a while since I've had to decode something... I'm consuming a

web service that is returning a Base64 encoded value... the web service
is

SOAP XML and returns a corresponding XML response encoding=UTF-8.


I've tried using Scott Klement's Base64 service program... I'm not
getting

an error, but the resulting value is blank?


Do I need to do something with the data before decoding?


TIA

Greg

--

This is the RPG programming on IBM i (RPG400-L) mailing list

To post a message email:

<mailto:RPG400-L@xxxxxxxxxxxxxxxxxx>

RPG400-L@xxxxxxxxxxxxxxxxxx


To subscribe, unsubscribe, or change list options,

visit:

<https://lists.midrange.com/mailman/listinfo/rpg400-l>

https://lists.midrange.com/mailman/listinfo/rpg400-l


or email:

<mailto:RPG400-L-request@xxxxxxxxxxxxxxxxxx>

RPG400-L-request@xxxxxxxxxxxxxxxxxx


Before posting, please take a moment to review the archives

at

<https://archive.midrange.com/rpg400-l>

https://archive.midrange.com/rpg400-l

.


Please contact

<mailto:support@xxxxxxxxxxxxxxxxxxxx>

support@xxxxxxxxxxxxxxxxxxxx

for any subscription related

questions.


Help support midrange.com by shopping at amazon.com with our affiliate

link:

<https://amazon.midrange.com>

https://amazon.midrange.com



--

This is the RPG programming on IBM i (RPG400-L) mailing list

To post a message email:

<mailto:RPG400-L@xxxxxxxxxxxxxxxxxx>

RPG400-L@xxxxxxxxxxxxxxxxxx


To subscribe, unsubscribe, or change list options,

visit:

<https://lists.midrange.com/mailman/listinfo/rpg400-l>

https://lists.midrange.com/mailman/listinfo/rpg400-l


or email:

<mailto:RPG400-L-request@xxxxxxxxxxxxxxxxxx>

RPG400-L-request@xxxxxxxxxxxxxxxxxx


Before posting, please take a moment to review the archives

at

<https://archive.midrange.com/rpg400-l>

https://archive.midrange.com/rpg400-l

.


Please contact

<mailto:support@xxxxxxxxxxxxxxxxxxxx>

support@xxxxxxxxxxxxxxxxxxxx

for any subscription related questions.


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

<https://amazon.midrange.com>

https://amazon.midrange.com




[https://www.medtronsoftware.com/img/MedtronMinilogo.bmp] Kevin
Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550
https://www.medtronsoftware.com



CONFIDENTIALITY NOTICE

This document and any accompanying this email transmission contain
confidential information, belonging to the sender that is legally
privileged. This information is intended only for the use of the
individual or entity named above. The authorized recipient of this
information is prohibited from disclosing this information to any other
party and is required to destroy the information after its stated need
has
been fulfilled. If you are not the intended recipient, or the employee
of
agent responsible to deliver it to the intended recipient, you are hereby
notified that any disclosure, copying, distribution or action taken in
reliance on the contents of these documents is STRICTLY PROHIBITED. If
you
have received this email in error, please notify the sender immediately
to
arrange for return or destruction of these documents.
--
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

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