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



While not reflection in the purist sense, it is possible to write your own interface to achieve some of what you want.

First the called program has to have been compiled with the option PGMINFO(*PCML: *MODULE). Once that is done then PCML is stored in the module object that describes the parameters, program name etc. That can be used directly by the JT400 toolkit for Java calls. You can also retrieve it programatically with the API QBNRPII.

Since PCML does not support all possible parameter types etc. it is not a complete solution but it is not something the RPG team can do anything about without help from the OS and the JT400 team.

Similar situation with Operational Descriptors - RPG can only use what the system supports - and that needs to be extended.


On 2013-10-30, at 10:21 AM, Charles MARTIN <cmartin@xxxxxxxxxxxxxxx> wrote:

Hello everyone,

I wish i could do some reflection using RPGLe.
By reflection, I mean :
'The process or mechanism of determining the capabilities of an object at run-time.'

Imagine you have this datastructure :

D DS_Format DS Qualified Based(pDS_Format)
D Type 20I 0 Inz(1)
D Label 50A Inz('myLabel')
D Description 5000A Inz('myDescription')

With a reflection api, I could do this :
Reflection_ListSubfields(DS_Format);
=> return this array : { 'Type', 'Label', 'Description' }
And then, I could do :
Reflection_GetSubfield(DS_Format : 'Label');
=> return 'myLabel'

I wish i could do this too :
Reflection_GetSubfieldType(DS_Format : 'Label');
=> return 'A'
Reflection_GetSubfieldLength(DS_Format : 'Label');
=> return 50
Reflection_GetSubfieldPrecision(DS_Format : 'Type');
=> return 0


With this, I expect I could do something like this (with some little work) :
SerializeXml(DS_Format); //I build xml with one line of code !
And get :
<DS_Format>
<Type>1</Type>
<Label>myLabel</Label>
<Description>myDescription</Description>
</DS_Format>
And conversely with DeserializeXml(myXml);

Reflection would help me to build really cool apis.
Is there any way ?

Charles
--
This is the RPG programming on the IBM i (AS/400 and 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.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com





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.