|
Walter,
I would use a class with a method of setParameter(String) to set the
parameters from the RPG program, then use the class to call the main method
of the class you are having a problem with. In other words:
Prototype ClassA in RPG....
public ClassA {
private Vector parms = new Vector();
public void setParameter(String parameter) {
if (parameter != null) {
parms.add((Object) parameter);
}
}
public void callFop() {
int parametersize = parms.size();
String[] args = new String[int];
for (int x = 0; x < parametersize; x++) {
args[x] = (String) parms.elementAt(x);
}
Fop fop = new Fop();
fop.main(args);
}
}
Using a Vector will give you a variable size array like structure. Using
Java to Java will resolve the problems of the variable size array for the
main method.
Mike
----- Original Message -----
From: <Walter_Hesius@msp.be>
To: <rpg400-l@midrange.com>
Sent: Monday, October 21, 2002 4:07 AM
Subject: Re: Coding the main method in a Java/RPG call
>
> Hi all,
>
> I'm trying (experimenting) to prototype the apache FOP parser.
> This example works fine, but the number of object you can pass, varies.
> If i set DIM to a higher value, i get an java exception:
>
>
>
> h DftActGrp(*No) ActGrp(*caller)
>
> d fop Pr ExtProc(*JAVA:
> d 'org.apache.fop.apps.Fop':
> d 'main')
> d Static
> d args O Class(*java:'java.lang.String')
> d Const
> d Dim(32767)
> d Options(*varSize)
>
> d newString Pr O ExtProc(*JAVA:
> d 'java.lang.String':
> d *CONSTRUCTOR)
> d Value 100a Const Varying
>
> d Parms s O Class(*java
> d : 'java.lang.String')
> d Dim(2)
>
> /Free
> Parms(1) = newString('/home/wh/xml/oef/msp_a4_p.fo');
> Parms(2) = newString('/home/wh/xml/oef/msp_a4_p.pdf');
> fop(Parms);
> ReTurn;
> /End-Free
>
>
> Error:
>
>
> Message . . . . : Java exception received when calling Java method.
> Cause . . . . . : RPG procedure PARSERS in program PARSERS/XMLPARSERS
> received Java exception "java.lang.ClassFormatError:
> org/apache/fop/apps/CommandLineOptions" when calling method "main" with
> signature "" in class "org.apache.fop.apps.Fop".
>
>
>
> Also,
>
> Coding the Parms variable as:
> D parms s O like(newString)
> D dim(2)
> didn't seem to work for me (it won't compile)
>
>
>
> Groetjes,
>
> Walter
>
> Walter Hesius
> Senior Application developper Iseries (as/400)
> Walter_Hesius@msp.be
>
> MSP n.v.
> Mechelsesteenweg 186
> 2650 Edegem
> Tel : +32 (0)3 454 27 88
> Fax: +32 (0)3 454 27 88
> www.msp.be - info@msp.be
>
> The information contained in this transmission is proprietary and
> confidential and is intented only for use of the individual or entity
named
> above. If the reader of this message is not the intended recipient, the
> reader is notified that any consideration, dissemination or duplication of
> this communication is strictly prohibited.
>
>
>
>
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
> or email: RPG400-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
>
>
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.