1

Has anyone ever split or merged tiff image files using the “RPG” programming language ? I know it can be done using Java and libTiff but I need RPG to do it as this is a pure RPG shop. I would appreciate any code showing this implementation.

Jim Barnes
  • 11
  • 2
  • RPG could do it, it is turing complete. But why? Just use Java, node, python...some other language that's available on the IBM i and has an existing library to merge and split tiff images. – Charles Jul 13 '22 at 19:15
  • Honestly, if you're a "pure RPG" shop, I suspect you'd be lost trying to do it in RPG. – Charles Jul 13 '22 at 19:16
  • Actually I’d be using ILE RPG IV and able to bind with C library and IFS functions on iSeries. Also this is not my idea, it is a management mandate. But thanks for the advice. I thought I heard someone had already done this. – Jim Barnes Jul 13 '22 at 19:19
  • That doesn't strike me as a pure RPG solution... – Charles Jul 13 '22 at 20:01
  • I agree it a not pure. But it presents purity from the “maintainable” code standpoint. From that standpoint it meets management’s objective. All other code is IBM’s responsibility. – Jim Barnes Jul 13 '22 at 20:28
  • I would try using PHP to handle the TIFF files. Write TIFF related functions in PHP and expose those functions as a web service. Then call the web service from RPG using the `httppostclob` sql function. The ImageMagick PHP package says it supports TIFF files. You could install XAMPP on your PC to get the PHP code working as a proof of concept. – RockBoro Jul 16 '22 at 03:15
  • Found that an rpgle service program that split and merged tiffs using the tiff 6.0 API specs was developed 20 years ago but it is in a private company library. Darn! – Jim Barnes Aug 05 '22 at 04:11
  • Apparently it is still in use. – Jim Barnes Aug 05 '22 at 04:20

1 Answers1

0

The best way to do this without writing Java, barring that you actually find an RPG library to do this, is to get an open source library to do it. Whether that library is C or Java, then you just need to write the RPG prototypes to make the RPG calls into C or Java. But you don't have to maintain any C or Java code. Of course, the C might have to be ported, and someone will have to know enough about C or Java to write the prototypes. The porting of C might present a challenge, but writing the prototypes will be easy enough.

I found this: http://www.libtiff.org/build.html should be able to be built into PASE, then you will have C routines that you can build into a service program and call from RPGLE.

jmarkmurphy
  • 11,030
  • 31
  • 59