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



I didn't even think about "private" procedures.....

If the procedure is "private" and thus only used within the module,
then I leave the prototype in the module as well.

It doesn't make sense to me to put the prototype in a copy book when
the procedure can't be used by anybody else.

Most of my private procedures exist to provide modularity with defined
interfaces to the code. Not for reusability.

Charles

On Mon, Dec 22, 2008 at 9:59 AM, Adam Glauser <adamglauser@xxxxxxxxx> wrote:

Yes. If you are familiar with Java or other OO languages, this is like
a "private" method. You essentially get a subroutine that can avoid
using global variables and has a well defined interface. One benefit is
that if you later realize that this is something that could be used in
multiple programs after all, it is a lot easier to move it to a service
program than if it was originally written as a subroutine.

The fact that procedures can be (and should be, where possible) written
so they have no side effects leads to IMO the biggest benefit of
procedures over subroutines. Maintenance is a lot simpler if you can
just look at the CALLP line and determine whether the variables you are
interested in are used or changed by the procedure. With subroutines,
you have look at the subroutine code and determine which variables are
updated and which key lists are used before you can confidently change
any of the code surrounding the EXSR.

Also, just to be clear, it would be the prototype in the copybook, not
the procedure. Your instinct is right however. If the code is reusable
within a single program, there is a good chance it can be reused in
other programs as well.

HTH,
Adam

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.