|
Steve,
either method looks confusing. Do people use /if defined to bring in code
or prototypes? Personally, the only in-line code I bring in using an /IF DEFINED is debug code. But then, the only in-line code I bring in using a /COPY is 'standard' *PSSR code - I don't like using compiler directives (any of 'em!) in C-specs.
Instead of conditionally compiling code I prefer to have the code exist in
service program procedures. And instead of conditionally including prototypes it is easier for me to have one PR source member for each service program. Then the module being compiled simply includes the PR source members of the service programs it will be calling into. I find that even 5000 line PR source members compile fairly quickly. What do you do about duplication? For instance, what do you do if you have a program which calls 2 IBM API's, both of which use QUSEC? Do you have a copybook which defines the QUSEC structure and explicitly include it in your program? Do you have any 'standard' variables that are used by different procedures in different service programs? I tend to use one copybook per module - each module tends to include related procedures, so it makes sense to group them that way. In a multi-module *SRVPGM, this might mean that an application program would include several /COPY's for each module used instead of a single *SRVPGM-level /COPY, but I think the reduction in needless procedure definitions is worth it.
...bottom line is I recommend against conditional compilation.
Fair enough. I think we would probably agree that it makes sense to have a single copybook per 'group' of related functions, whether it be at a module- or *SRVPGM-level. Rory
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.