× 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 18/12/2004, at 7:05 AM, Larry wrote:

That's an interesting idea. I'd find it scary if it worked. Personally, I'd
rather use getter methods to retrieve variable data across module
boundaries. My reasoning is that, as RPG only really has two access
modifiers - PUBLIC (exported) and PRIVATE (not exported), you can't have
"package" or "protected" access to your own data. Thus, if you export a
variable from one of your modules you are allowing it to be modified by ANY
client program that binds to your service program.

Not true. You can't get protected semantics but you can simulate package behaviour.


Specifying EXPORT will always export the variable or procedure from the module but it is only available to other modules that directly bind to it. If the module containing EXPORT is bound into a service program then EXPORT means it is a candidate for export. Whether it is visible by consumers of the service program depends on the the setting of EXPORT on CRTSRVPGM. If you use EXPORT(*ALL)--really dumb for reasons explained in the archives--then any candidate export will be visible. If you use binding source then you can omit the candidate variable or function from the public interface. It will still be available to other modules bound directly into the service program but will not be accessible by consumers of the service program.

You may want some of your
own programs access to the data, but not ANY program. The only safe way to
allow "restricted" access is to encapsulate the data through sub-procs. The
sub-proc can then perform some form of validation prior to returning the
variable data. The other beauty of encapsulation is that you can modify HOW
you generate the data internally, and return different values in different
scenarios. By laying bare your internal variables you restrict your ability
to re-design your module code.

Notwithstanding my comments above I agree that providing so-called accessor methods is the best approach.


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