× 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.



Barbara,

I tried what you said, and I'm still having a couple of problems.

1.  If I remove the STATIC keyword, the RPG program will not compile.  I
have changed the way I am calling this from an EVAL to a CALLP, because
without the return value in the prototype, it won't let me do an EVAL
(which makes sense).  This is how I'm calling it:

c                   callp     conversionTest(sFile:format)

The prototype now looks like this:

D conversionTest  PR                  ExtProc(*JAVA:
D                                            Class1:'conversionTest')
D                                     STATIC
 *  method parameters
D  f                              O   Class(*JAVA:'java.io.File')
D                                     Const
D  format                       10I 0 Value

Format is also defined in the D specs as follows:

D format          S             10I 0

The compiler tells me that

*RNF5406 30      1 The call passed fewer parameters than the prototype
indicated
                   are required.
*RNF7536 30      1 The type of the parameter specified for the call does
not
                   match the prototype.

2.  If I leave STATIC in (which I don't doubt is wrong), the RPG program
will compile.  However, it bombs when I call it and gives me the following
error:

Message . . . . :   Java exception received when calling Java method (C G D
  F).

Cause . . . . . :   RPG procedure ICR001 in program ICR001/MIKEE received
Java
  exception "java.lang.NoSuchMethodError: conversionTest" when calling
method
  "conversionTest" with signature "(Ljava.io.File;I)V" in class
  "conversionTest".

Running javap on the conversionTest.class tells me the following:

> javap -s conversionTest
  Compiled from conversionTest.java
  public synchronized class conversionTest extends java.lang.Object
      /* ACC_SUPER bit set */
  {
      public conversionTest(java.io.File,int);
          /*   (Ljava/io/File;I)V   */
      public static void main(java.lang.String[]);
          /*   ([Ljava/lang/String;)V   */
  }

I don't doubt that having the STATIC keyword is wrong and is screwing me
up, but I'm curious here.  According to how I'm reading the message
information, the java.lang.NoSuchMethodError is telling me that it can find
the class, but that there's no method named conversionTest with the right
signature (so my CLASSPATH is ok?).  But javap looks like there IS a method
called conversionTest with the right signature.  Or is the slash/dot thing
a problem?  And if so, what is it telling me?

Mike E.





                    Barbara Morris
                    <bmorris@ca.ibm.c       To:     rpg400-l@midrange.com
                    om>                     cc:
                    Sent by:                Subject:     Re: Prototyping and 
Creating integer objects in RPG for
                    rpg400-l-admin@mi        calling  Javaclasses
                    drange.com


                    11/15/02 12:46 PM
                    Please respond to
                    rpg400-l






meovino=/SPx079MrvAgMxX8nMqP6gC/G2K4zDHf@public.gmane.org wrote:
>
>
> Cause . . . . . :   RPG procedure ICR001 in program ICR001/MIKEE received
> Java
>   exception "java.lang.NoSuchMethodError: conversionTest" when calling
> method
>   "conversionTest" with signature "(Ljava.io.File;I)S" in class
>   "conversionTest".
>
> When I run javap -s on the conversionTest.class file, I see the following
> signatures:
>
>    public conversionTest(java.io.File,int);
>        /*   (Ljava/io/File;I)V   */
>
> I can see that they don't match.  But it looks like I've got the inputs
> correct; it's the "S" vs. "V" thing.  Here's the prototype for my Java
> program, conversionTest.class
>
> D conversionTest  PR             5I 0 ExtProc(*JAVA:
> D                                            Class1:'conversionTest')
> D                                     STATIC
>  *  method parameters
> D  f                              O   Class(*JAVA:'java.io.File')
> D                                     Const
> D  format                       10I 0 Value
>
> I'm guessing the S in the signature is coming from the STATIC keyword.  I
> can't find any documentation on what keyword I should be using that would
> give me a "V" in the signature.
>

Mike, the S is coming from the 5i 0 return value (S for short).  Just
remove the return value and you will get a V (V for void) in the
signature.

But you shouldn't have the STATIC keyword either.  You would only code
STATIC if the Java method had "static" in its header.

(The signature doesn't contain anything about static-ness.)


_______________________________________________
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 thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.