× 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 Thu, 6 Jan 2005 14:29:38 -0500, Paul Morgan <pmorgan@xxxxxxxxxxxxxx> wrote:
> Steve,
> 
> A reflection API would allow querying of an object to retrieve it's
> interfaces and the parameters for those interfaces.  For example I can
> retrieve a list of all procedures exported by a service program using the
> List Service Program Information API.  However, there is no API that lists
> the parameters of an exported procedure.  Without that list a program can't
> make a blind call to it.  In your example I'd like to be able to call an API
> to find out what GetGlobalVariable was going to return.  A packed decimal
> nine digits long with two decimal places?  A C style null terminated string?
> A date?

thanks Paul.  I have read the term, just did not know what it meant.  

I think IBM is moving towards this with the XML output of the RPG
compiler. There is also the LISTING view of a module that is
accessible thru the debugger APIs.  The Listing view, as opposed to
the Text view, is stored in the module itself.  So with a whole lot of
work you could list the listing view of a module, then scan it for the
PI statements and find the source lines of the parameters immediately
after the PI of the procedure.  That would reliably tell you the data
types of the parameters.

-Steve

> 
> One example of a use for a reflection API:  Generate a Command/OPM program
> proxy pair for any service program procedure.  At the very least this would
> be useful for testing the service program.
> 
> Another useful example:  Get rid of seperate prototype definitions as a
> requirement for using a service program.  Generate a prototype source member
> for all exported procedures 'on the fly' with a precompiler.
> 
> Java supports this.  I can make a call to a procedure on a java object
> without even knowing the name of the procedure or the types of it's
> parameters.  It's all done through a reflection API.  Very cool.  A lot of
> functionality in Java relies on reflection.
> 
> I agree that exporting variables by themselves is a 'bad thing'.  As you
> described you'd want to export getter and setter procedures for the
> variable.  But it would be better if the variable type required by a getter
> or setter procedure was also exported as part of the procedure export.
> 
> Paul
> 
> --
> Paul Morgan
> Senior Programmer Analyst - Retail
> J. Jill Group
> 100 Birch Pond Drive, PO Box 2009
> Tilton, NH 03276-2009
> Phone: (603) 266-2117
> Fax:   (603) 266-2333
> 
> "Steve Richter" wrote
> >
> > what are the reflection APIs?
> >
> > on the broader topic of exporting of variables, isnt it always better
> > for a module to provide a set of exported procedures that allow
> > controled access to a global variable in a module?
> >
> > Such a procedure, like "GetGlobalVariable" would make the global
> > variable accessible to any other procedure or program.  not just to to
> > procedures within the same service program.
> >
> > -Steve
> 
> --
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> 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 ...

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.