×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
On 12/21/2012 11:14 AM, Richard Schoen wrote:
I found a Java example and it took about 30 minutes to put together a general Java program to accomplish this.
I wrapped it with a CL program and Viola it's done.
Hate to say it but for complex things like XML, Java is much more efficient.
Two things. First, XML isn't complex. The problem is the
implementation. It's a stream file, something that RPG has never been
strong dealing with. We've gotten MUCH better over the years with
varying fields and a number of other great capabilities, but still it's
not RPG's strong suit. I don't care is it's CSV, PNG or XML, RPG isn't
optimal for stream files. That being said, you can do a whole HECK of a
lot with the XML support in RPG; combine XML-INTO and CGIDEV2 and RPG is
a very powerful XML processing environment. Whether to use it depends
on how much back end RPG you need to do.
Second, the problem is the implementation :). When you say "update" you
don't really mean update. To update an XML file, you literally rewrite
the stream file. Java may hide the complexity, but you're still
rewriting the stream. You don't just insert (or delete) a few bytes in
the middle of the file. You can do the same thing in RPG relatively
easily, but it's not as straightforward as the wrappers that Java
provides. As usual in RPG you have to do a lot of the heavy lifting
yourself.
But that's all going to change. You might want to check into DB2 9,
which is currently only available for DB2 LUW but hopefully is coming
soon to an IBM i near you (and me!). DB2 9 uses pureXML which in my
opinion will pretty much do away with most of the XML processing we do
today.
You can directly query an XML document much like you would a normal
relational table and you can combine relational and XML access, updating
one from the other, all at a high level and without having to shred the
XML document yourself.
It's most bodacious.
Joe
As an Amazon Associate we earn from qualifying purchases.