|
> These procedures are all in the same module. I thought about making the > data structures global, but I really want each of the four "main" procedures > to have independent copies of the data. I could, of course, define four > global data structures with the PREFIX keyword, but I think the > EXPORT/IMPORT approach is more elegant. What you really should do is use QUALIFIED data structures and LIKEDS() parameters -- unfortunately, this requires V5R2. IMPORT/EXPORT won't solve your problem. import/export allows multiple programs to share global variables in the same manner that multiple procedures in the same module can share data. If your procedures are already in the same module, it buys you nothing. In any case, using IMPORT/EXPORT is considered a bad programming practice. It creates a hidden interface between your program and other programs. Instead, use parameters. One of the most important aspects of modular programming is having well-defined interfaces. > It has the added benefit of showing the relationship between the "main" > and "child" procedures. I don't follow this. > I hadn't thought about using pointers for this, but I probably should have. > I am using them to handle a multi-occurrence data structure in another > module. Frankly, defining your parameters as LIKEDS is a much better idea than using pointers. But, using a pointer is a parm is still much much better than using import/export!!
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.