|
Scott,
Many thanks, your correction to my prototype made the RPG compiler happy,
but I had to upgrade from POI-1.5 to POI-2.0 in order to make the runtime
work. I dunno, if the CLASSPATH points to POI-2.0 it works, if it points to
POI-1.5 it fails everytime.
I'd seen and studied Kevin Vandever's series of articles before, but had
not seen Giuseppe Costagliola's excellent "Excel on the Fly" utility. I even
liberated some of his code that sets the CLASSPATH inside the RPG.
JK
> ------------------------------
>
> message: 8
> date: Thu, 6 Nov 2003 15:03:28 -0600
> from: "Scott Johnson" <sjohnson@xxxxxxxxxxxxx>
> subject: RE: Help needed with RPG prototypes and POI
>
> Your PR should be:
>
> * // writeWB(java.io.OutputStream)
> D writeWB PR EXTPROC(*JAVA
> D
> :'org.apache.poi.hssf.usermodel-
> D .HSSFWorkbook'
> D :'write')
> D parm O CLASS(*JAVA
> D :'java.io.OutputStream')
>
> Call it this way:
> writeWB(wb:outFile);
>
> You do not need to prototype the first parm(wb) in the 'call'.
> It is the object
> that the writewb will operate on.
>
>
> Create a CL wrapper and call your RPG module from there:
>
> MONMSG MSGID(CPFA980)
> ADDENVVAR ENVVAR(CLASSPATH) +
> VALUE('/javalib/jakarta-poi-1.5.1.jar')
>
> CALLPRC PRC(POIMSAMP)
>
> Getting the classpath to work is very important. If you call
> your RPG program
> interactively, your classpath/JVM is set until you sign off. So
> it is best to
> create the cl wrapper to set the classpath and submit it to
> batch. Took me
> quite a while before I got that worked out. Once I did
> everything fell into
> place.
>
> Here is a different example to check out:
> http://www.mcpressonline.com/mc/1@xxxxxxxxxxxxxxxx@.6ae8269f!more=1#more
>
> One thing I found in both examples is that they do not close the
> file when they
> are done. This can leave a lock on the excel file. Add the
> following to your
> source:
>
> * // closeFile(java.io.OutputStream)
> D closeFile PR EXTPROC(*JAVA
> D :'java.io.FileOutputStream'
> D :'close')
>
> After the writeWB add:
>
> // Close file
> closeFile(outFile);
>
>
>
> Other References:
> http://www.midrangeserver.com/mpo/mpo022802-story06.html
> http://www.midrangeserver.com/mpo/mpo013102-story02.html
> http://www.midrangeserver.com/mpo/mpo041003-story01.html
> http://www.midrangeserver.com/mpo/mpo042403-story04.html
>
>
> -- Scott J.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.