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



There is a utility available on www.rpglanguage.com/copybook which will achieve this quite neatly.

It is /COPYBOOK and allows you to copy from a source member by from-to line number or by from-to label - much more elegant
than loading up lines of un-related code or using multiple IF statements.

It's free and was written by myself.

Regards,
John McKay mba

On 30/06/2011 16:22, BButterworth@xxxxxxxxxxxxxx wrote:
Another option is that with the use of compiler directives, you can copy
the prototypes out of your module source without the use of an additional
copybook member like so:

Module source:

/if not defined(PROTO)
* Code you don't want to copy
h ...
h ...
f ...
f ...
d ...
/endif

* Code you want to copy
d dsFoo ds qualified
...

d writeToFoo pr
d message 350a value
...

/if defined(PROTO)
/eof
/endif

d...
c...

blah, blah, blah

Calling program/module source:

/define PROTO
/copy<module source member with prototypes>

This technique may be more obscure, but it keeps the prototypes with the
module source.

Blake



date: Thu, 30 Jun 2011 09:11:17 -0500
from: Kurt Anderson<kurt.anderson@xxxxxxxxxxxxxx>
subject: Copybooking PRs WasRE: Impossible to even think about
rewriting in RPG

In this list and in presentations I often hear about people putting _all_
of their prototypes into _one_ copybook. This has always boggled my mind
and I feel like maybe there's something I'm not grasping.

Like Bryce, we have a special source member for copybooks (we make these
members end in a Y - C was taken for CLs). Each Service Program of ours
has its own copybook to share its exported procedure prototypes as well as
any Data Structure templates, global variables or constants required by
the caller or service program.

I can't imagine putting all of that into one copybook. It seems like a
step toward the monolithic pain in the a$$. I'd imagine cleanup of it
would be a pain as well.

Thoughts?

Kurt Anderson
Sr. Programmer/Analyst
CustomCall Data Systems

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Bryce Martin
Sent: Thursday, June 30, 2011 8:04 AM
To: RPG programming on the IBM i / System i
Subject: Re: Impossible to even think about rewriting in RPG

John,
I know it seems a bit scattered, but I put all of my PR's in source
members in a source file called QCOPYSRC. So anytime I need a prototype
for a service program or regular program I just do...

/copy QCOPYSRC,PROGCP
So instead of suffixing with an R or P or whatever you use in the program
name I'll suffix my copy members with CP. So there isn't really much to
think about. That will then make those available to call. Once the
organization is set up and you get your thinking to line up with the new
methods and processes it becomes second nature and, in my experience, is
much faster and more organized.


Thanks
Bryce Martin
Programmer/Analyst I
570-546-4777



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.