|
Hi Kurt, <snip> I have never implemented what I'm about to mention, and I don't know if this is what you're looking for, but... If you have a module that calls other modules, those other modules can access fields (or Data Structures) from the first module if you define those with the Export and Import keywords. Module 1: D Ind1 S N Export Module 2: D Ind1 S N Import </snip> 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. 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. Cheers Larry Ducie
As an Amazon Associate we earn from qualifying purchases.
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.