How to use BASE64 decode library

Other open source tools published on ScottKlement.com
Post Reply
richardchen
Posts: 3
Joined: Fri Jun 23, 2023 1:24 am

How to use BASE64 decode library

Post by richardchen »

Dear all,

I run a Python program in iSeies. The pgm will communicate with a sever to process transaction data. The data has ascii and binary format. After rcv the message (bytes string), I use Python package itoolkit (based on xmlservice) to call a rpgle program as parm.

Because of the binary data the itoolkit amended: invalid token in xml element. So I want to pass the message to the rpgle pgm with base64 encoded message. It is easy to encode the msg with Python with codepage iso-8859-1.

I got trouble to decode the msg in rpgle. I have try SK’s BASE64 lib, db2 systools.base64decode, service pgm qsysdir/qaxis10ht. But no luck.

I found a sample to use BASE64 encode with ccsic 1208 from SK, it works. But I did not know how to use the decode? If you have a sample, can you share to me? Thanks!
Scott Klement
Site Admin
Posts: 658
Joined: Sun Jul 04, 2021 5:12 am

Re: How to use BASE64 decode library

Post by Scott Klement »

richardchen wrote: Fri Sep 22, 2023 8:33 am Because of the binary data the itoolkit amended: invalid token in xml element. So I want to pass the message to the rpgle pgm with base64 encoded message. It is easy to encode the msg with Python with codepage iso-8859-1.
I'm not sure what you mean by "encode the msg with Python with codepage iso-8859-1". What is encoded? Do you mean the base64 encoded data is expressed in code page 819 (iso-8859-1)? Or do you mean that you translated the underlying ascii data to iso-8859-1 before encoding it? (Which I think is a bad decision) or... what do you mean? And how is this data going to be sent to the RPG program?
richardchen wrote: Fri Sep 22, 2023 8:33 am I got trouble to decode the msg in rpgle. I have try SK’s BASE64 lib, db2 systools.base64decode, service pgm qsysdir/qaxis10ht. But no luck.
We will need to know more about the problem than simply "I got trouble". Any of these options will work if you are doing it correctly.
richardchen wrote: Fri Sep 22, 2023 8:33 am I found a sample to use BASE64 encode with ccsic 1208 from SK, it works. But I did not know how to use the decode? If you have a sample, can you share to me? Thanks!
Sample of what? I don't understand what you're trying to achieve. Saying you found an example of 1208 doesn't tell me what that sample does! If we're working with base64 encoded data, it should not matter if it is 1208 (utf-8) or 819 (iso-8859-1) since all of the characters in the base64 alphabet have the same code points in both encodings.
Post Reply