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



When I see code + prototypes, I usually see the prototypes at the top
not the bottom.

But I assume the idea behind it is the same, instead of having a
seperate copy member you just have the one member with compiler
directives that control rather of not only the prototypes are seen.


d MyProcedure pr
d parm1 10a


/if defined (PROTOTYPES_ONLY)
/EOF
/endif

p MyProcedure b
d MyProcedure pi
d parm1 10a
/free
//actual code here
/end-free
p MyProcedure e


Thus in a module that needed to call MyProcedure, I'd have something like so

/define PROTOTYPES_ONLY
/copy MyProc

The one-member style is just that, purely a stylistic choice. It's
proponents will tell you why they like it and it detractors will tell
you why they don't.

I happen to be the later. I think it clutters up the source and if
you wanted to provide a closed source utility, the prototypes would
need to be in a standalone file anyway. In addition, I think having
two seperate members makes working on both at the same time easier.
Granted WDSCi does allow you to work in multiple places in the same
source at once.

Charles


On Mon, Dec 22, 2008 at 9:04 AM, <GKern@xxxxxxxxxxxxxxxx> wrote:
I've seen a few instances of where the actual code for a prototype (or
more than one prototype) is found at the bottom of an RPG source member.

I've often read and learned to code almost all of my prototypes to be
accessed via /copy members where the actual code is either a separate
module or part of a service program.

The only reason I see for doing this would be to be able to use them like
subroutines that could accept parameters where the process is performed
only within a single program. But then wouldn't that still lend itself to
a /copy book? Or is this just a matter of personal preference that is
arbitrary to the application?

Or are there other reasons for coding prototypes at the bottom of an RPG
program that I'm unaware of?

Any links to good articles explaining this approach would be appreciated.

Thanks!

Regards, Jerry

Gerald Kern - MIS Project Leader
Lotus Notes/Domino Administrator
IBM Certified RPG IV Developer
The Toledo Clinic, Inc.
4235 Secor Road
Toledo, OH 43623-4299
Phone 419-479-5535
gkern@xxxxxxxxxxxxxxxx


This e-mail message, including any attachments, is for the sole use of the
intended recipient(s) and may contain confidential and privileged
information. Any unauthorized use, disclosure or distribution is
prohibited. If you are not the intended recipient, please inform the
sender by reply e-mail and destroy this and all copies of this message.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



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.