I have an RPGLE variable that contains a BASE64 string of an image. Does anyone know how I can save that data on the IFS as a jpg?
Asked
Active
Viewed 598 times
2 Answers
2
Before saving to the IFS as suggested by @jtaylor___
You'll need to decode the BASE64 string back into a binary value.
Scott comes to the rescue again with Base64 Encode/Decode for ILE RPG
Also available are the Apache Portable Runtime (APR) base64 routines
Once you have the binary data in a variable, you can write it out to the IFS with JPG extension...

Charles
- 21,637
- 1
- 20
- 44
-
True about decoding first. I use Scott's library for encoding. Works like a champ. – jtaylor___ Sep 18 '20 at 17:19
1
Check out Scott Klement's "Working with the IFS in RPG IV" (https://www.scottklement.com/rpg/ifs_ebook/). It should be a simple matter of using the write() method to file with a JPG extension.

jtaylor___
- 609
- 1
- 6
- 14