On 11/18/2015 10:43 AM, John Yeung wrote:
-snip good stuff-
I want to stress for folks that are not already
knee-deep in POI-via-RPG (and maybe *especially* for folks that are!)
that there are easier ways. My preferred way is Python, but there are
others. Perhaps the most straightforward, for folks who have already
made the investment of learning Java, is to just use Java. That is,
forget about wrapping POI with RPG, and just call POI directly from
Java. Then you *will* have Java's native garbage collection take care
of everything for you.
All true. (As an aside, there is a Java mailing list but it doesn't get
much in the way of traffic so subscribing to it won't place heavy
demands on one's time.)
The downside of a separate Java program (or Perl or PHP script, or
Python program) is that it's /separate/. If my task were to convert
SALESHIST to Excel, I'd probably do it in Python. But if my task were
to integrate a spreadsheet into an existing program, what can I do? For
example, I have a large (400+ printed pages) report that I need to add a
spreadsheet of 'important' sales so that the account rep can easily
review them vice manually searching through a spooled file.
The crux of my dilemma is this: My existing RPG program has all the
database I/O. It has all of the business rules needed to put the
disparate files together. It has the rules for identifying 'important'
sales - it puts '***' on the report :-( I don't want to re-do all that
stuff in Java or Python; what do I do?
The more or less classic answer is Yet Another Work File which then gets
passed on to Java or Python and have /that/ converted to a spreadsheet.
Custom this and that (red for significantly smaller sales!) gets
handled by writing business rules in the Java / Python program. So
formatting is a weird mélange of RPG, DDS and Java. Speaking only for
myself here, ew.
At the moment, only Java has enough integration with RPG to allow for a
simple RPG programmer like me to make some API calls right in my RPG code:
if important;
*in35 = *on; // print eyecatcher
endif;
except printSale;
writeExcelRow(name: item: desc: qty: unit: extn: important);
Yes, there's a fair bit of setup work to get this going at all.
Yes, there's setup work in every program.
It seems to me that the alternatives are worse than this - for the task
of adding a spreadsheet to an existing program. Again, if it were a
more or less straightforward 'convert this file to Excel' I wouldn't use
RPG for that.
As an Amazon Associate we earn from qualifying purchases.