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



Hee hee!  Great minds, Sarah...

I came up with yet one more possibility: a service program procedure that
takes an object and five or six different variables of different types.  The
beauty of RPG procedures is that all the parameters can be bidirectional,
right?  So it would be something like this:

d ConvertObject   pr             3u 0                  
d   object                        O
d   alpha                       64a    varying                
d   binary                      20u 0 
d   decimal                     30s15 
d   logical                       n   
d   date                          d
d   timestamp                     z

d  wObject        s               o    class(*java:'java.lang.Object')
d  wAlpha         s             64a    varying                
d  wBinary        s             20u 0 
d  wDecimal       s             30s15 
d  wLogical       s               n   
d  wDate          s               d
d  wTimestamp     s               z

You do:

 /free
  object = getColumn(3);
  vartype = ConvertObject(object: wAlpha: wBinary: wDecimal (...));
  select;
    when vartype = 1;
      (process wAlpha)
    when vartype = 2;
      (process wBinary)
  endsl;
 /end-free

The job of ConvertObject would be to do the instanceOf checking and then
convert the object appropriately into one and only one of the parameters.
If it was unconvertible, you could return a negative value or something.
Ahhhh... so many ways to skin the cat!

Joe

> -----Original Message-----
> From: Sarah Poger Gladstone
> 
> Joe- Perhaps an approach that combines your idea and mine. The
> getColumn() method returns an Object, then another program takes the
> object and calls the "instanceOf()" method to find out the actual
> class, then it fills in the data structure that you proposed. Then
> passes a pointer to the populated datastructure back.
> Using this combined approach, the "getColumn()" method doesn't have to
> deal with populating the datastructure.
> 
> It would also simplify error handling. If the "instanceOf" method
> returns something that is not usable from RPG, then the Java program
> can throw/log an exception.
> 
> -Sarah Poger Gladstone



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