1

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?

jps
  • 20,041
  • 15
  • 75
  • 79
wendy
  • 21
  • 1
  • you're talking about the language RPG from IBM? I retagged the question for you, because the IFS tag is for something different and therefore misleading here. – jps Sep 18 '20 at 12:39

2 Answers2

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