Great advice everyone. Thank you.
From: John Yeung <gallium.arsenide@xxxxxxxxx>
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Date: 10/22/2015 05:06 PM
Subject: Re: Need help Scott's POI routines to generate XLSX files
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>
On Thu, Oct 22, 2015 at 3:04 PM, <darren@xxxxxxxxx> wrote:
I'm curious on the Python thing. I've not really dug into it, and I'm
wondering if its worth it. What limited examples I saw, were of
an Excel file from basically a file dump not much different than
a .csv. The example used some command line script to accomplish this.
Well, the point of examples like that is to show that *if* all you're
looking for is something quick and simple, it's easy to do with
Python, without a lot of scaffolding or boilerplate or setup. If you
think those examples are about as easy as generating a CSV, then it's
like getting an almost free upgrade to .xlsx. A lot of commercial
tools (not based on Python) are even specifically designed to work
that way: simplest possible dump from database file or table into
I assume more advanced functions are available in Python, otherwise it
wouldn't be necessary, so is the entire report logic being done in
We're doing things like colored column headers, conditional formatting,
formulas, break logic with subtotals, and most recently tables. Do you
all of that along with the report logic in Python instead of RPG?
Well, like most languages, there's no *built-in* support for .xlsx
files at all. With Java you've got POI. With Python, you've got
XlsxWriter (which is what I use) or OpenPyXL. But yes, those packages
are full-featured and provide a high-level, easy-to-use interface for
the application programmer.
I do have several projects on the i that are implemented completely in
Python: accessing the database, doing any kind of intermediate
processing, generating advanced Excel output, and e-mailing the
workbook as an attachment. All of the Excel stuff you describe is
supported by XlsxWriter.
Accessing the database and doing "report logic" is actually especially
convenient in Python. The Python I use, iSeriesPython, is equally
adept at RLA and SQL, so it does a nice job of replacing RPG in all
phases. I haven't used IBM's Python for PASE, so I can't say whether
that's *as* convenient as iSeriesPython. (It will come down to how
nice the i-specific toolkits are that IBM provides.)
You asked if it was "worth it". Obviously that was at least partially
rhetorical and partially subjective. But I can give some thoughts
anyway: I would say that if you already have an established
infrastructure for doing your reports and getting them into Excel, and
that's working well for you, then getting into Python solely as a
replacement for that is most likely not worth it. I mean, it *might*
be worth it, because I do firmly believe that a fluent Python
programmer can build a working Python+XlsxWriter project faster than a
fluent RPG programmer building the equivalent project with RPG+POI.
But no matter how easy it is to learn Python, there's still some
learning involved, whereas your existing stuff already works and you
already have expertise in it.
You'll notice I usually chime in with my Python pitch when someone is
just starting out with POI, or is having difficulties with POI, not
when they're already humming along with POI.
For shops where RPG+POI is already well established, there is still
some potential value to be had with Python, because Python is such a
versatile language and ecosystem. It's not a huge exaggeration to say
"anything Java can do, Python can do better". Also, I'm someone who
believes that learning almost anything is a good thing. Learning a new
language can open up new ways of thinking, and can potentially improve
your programming in general.
And to be completely honest, I just find Python plain old fun. It is a
hoot of a language. When I first stumbled upon it, it was week after
week of being blown away by how easy and powerful it was. Being blown
away with what was already in the standard library. The feeling was
like driving station wagons your whole life and suddenly being handed
the keys to a slinky sports car. (Upgraded by James Bond's Q.)
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives