× 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 23/11/2006, at 4:30 PM, Mike Pantzopoulos - ((H/O)) wrote:

I'm trying to immerse myself into the RPG/Java interface.

I'm trying to use an example from the ILE RPG Programmer's Guide as a
vehicle for flexing some code to understand how this functionality is
implemented.

On page 165 of the above manual is some example code (P165 Figure 77)
depicting a simple interface to the trim method of the java.lang.String
class.

I could not get the original version to compile until I added the class
keyword to the trimString prototype. The compiler was giving me the
following message:

RNF3951 30 26 002600 The CLASS keyword is required with datatype O.
The code in bold/italics (between lines 28-29) below is what I added 
and
got the program to compile - and run.

Did I do the right thing? Should the manual be updated?
Yes to both. It appears the examples are wrong. Many of the definitions 
are missing the appropriate CLASS keyword.
I can't understand why the class declaration is required as a separate
keyword as it is already defined as one of the method parameters anyway.
The example prototype indicates the method returns an object but what 
type of object? Without a CLASS keyword how will the compiler know what 
kind of object is returned?
Is there a reason that the two might ever be different?
Yes. See one of the other method definitions in the same figure 77. 
They show an example of using BigDecimal to convert a String containing 
digits into a BigDecimal. The conversion method is found in the 
BigDecimal class, the return value is also a BigDecimal, but the input 
parameter is a String. The CLASS keyword is needed to define the two 
different object types being used.
Many classes override the toString() method which returns a String 
representation of the object. The String is highly likely to be a 
different object from the class containing the method.

Regards,
Simon Coulter.
--------------------------------------------------------------------
   FlyByNight Software         AS/400 Technical Specialists

   http://www.flybynight.com.au/
   Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
   Fax:   +61 3 9419 0175                                   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

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 copyright@midrange.com.

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.