AS400: copybook or module? …or…other?

5020 pts.
Tags:
AS/400
iSeries
RPG
V6R1
WDSCi 7
I'm on V6R1, using WDSCi 7 to program in RPG IV.  I've accumulated a number of functions that I use in quite a few of my programs, and I was thinking it might be a good idea to go ahead and place them as subroutines (may be wrong terminology) in a copybook.  But, having done some research, there are downsides to using a copybook. So, what should I use?  I've never done this kind of thing on the AS400 before, so I'd like to do it right the first time.  :) I also read about modules, but they seem very unwieldy to use since you appear to have to use a different compile command and I don't even begin to understand how the syntax-checking could work... And then there is the whole service-program idea.  My head still hurts after the hoops I had to jump through to make the last one work. Maybe I have a lot of misinformation and there really is a simple way to do what I want to do.  Please help me make the right choice!  Thanks for your help!!

Software/Hardware used:
AS400 V6R1 RPG IV

Answer Wiki

Thanks. We'll let you know when a new response is added.

I believe creating a *SRVPGM with multiple procedures is what you want to do.
It is a different concept, that needs to be learned.
Like anything else, the unknown is hard, and once you have the answer, it seems simple.
Send me an email at charliebrowne99@gmail.com and I will try to send you some samples.
There are some great books out there that you should pick up to help you learn.
To make lit easier for yourself, you can create PDM options to do your complies.

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Koohiisan
    Instead of subroutines, I meant to say that I was wanting to make subprocedures out of these commonly used functions (which are already subroutines, but I have to currently copy/paste them into each pgm).
    5,020 pointsBadges:
    report
  • aceofdelts
    Subprocedures would be the "ILE" way. Sometimes it's more practical to make a callable program. Mainly depends on likelyhood that this subprocedure will be modified later. If so, a subprocedure would need to be re-linked to each using program while a callable program needs no re-link. The cost of a callable routine is in performance.
    1,850 pointsBadges:
    report
  • Cwc
    If you package the common procedures into a service program, nothing needs to be relinked if any of the logic in the the procedures has to be changed later on. It is only when their interfaces / signatures change, i.e, the number or type of parameters being sent or returned, that you would need to recompile the calling modules. And using binder language, you can even have the service program be backwards compatible by maintaining as many previous signatures as you want to support. This way, existing modules don't have to be recompiled as long as they don't need to send the new parameters, or don't need to use the new procedures that may be added into the service program over time. This is one of the ways in which ILE is a more powerful and flexibile development methodology than the OPM (original program model).
    4,290 pointsBadges:
    report
  • Koohiisan
    Thanks for the ideas! I think I will go the route of having a service program to handle these functions for me! I appreciate all the help from everyone! ^_^
    5,020 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following