How to update a service program into a program ?

1,720 pts.
Tags:
RPGILE
Service program
Using UPDPGM to bind a module into a program works fine.  Do I use this same command to bind a service program into a program (and just put it in the Module parm) ?

Or is there another command similar to UPDPGM ?

An older version of the service program is currently bound into the main program. I used UPDSRVPGM to bind a revised module into this service program. That was OK, but the results don't seem to show up in the main program.

 



Software/Hardware used:
as/400
ASKED: November 24, 2009  10:29 PM
UPDATED: November 29, 2009  12:07 PM

Answer Wiki

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

Service programs are implicitly bound by reference into the programs which use them. The other type of binding is by copy, where an actual copy of the module is bound into the final compiled program object. Thus, if the module changes the program must either be updated (via UPDPGM) or recreated.

So, if the service program is changed (via UPDSRVPGM) or recreated, the programs which use it will automatically use the newer version.

There would be additional considerations If the signature of the service program has changed. If so, that is where using binder language is beneficial, as it provides support for previous signatures of the service program.
<a href=”http://search400.techtarget.com/tip/1,289483,sid3_gci1141217_mem1,00.html”>http://search400.techtarget.com/tip/1,289483,sid3_gci1141217_mem1,00.html</a>

CWC
****************

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
  • TomLiotta
    The answer so far is correct. But the direct answer to your question is "Compile the program." There is no way to UPDPGM when you modify a service program used by the program. The reason for that is because there is no need for such a function as long as you do things right. There are two very basic kinds of changes you can make to a service program -- change the instructions and change the interface. If all you do is change the instructions (without changing the interface), then there is no "updating" of any program that refers to the service program. In a sense, that's the whole point of using service programs in the first place. You modify a service program, and all the programs that use it will simply start using the new one. Nothing more for you to do. The only time you need to recompile a program is if you change the interface. If you change a parm from packed-decimal to integer or from CHAR(10) to CHAR(20), you're going to have to make the corresponding change in the programs and recompile them anyway. However, with binder language and a little planning, you can even handle those kinds of interface changes without needing to recompile the programs. Basically, with binder language, you associate a signature with an interface description. The interface consists of the procedures that are exported from the service program (and a list of each proc's parms including data types and sizes; that parm list is maintained by the system and not shown in binder language). If you need to add a new proc, you would add a new signature that included the new proc as well as the old procs. The service program then has two signatures. If new programs are created or old programs are recompiled, and the new signature matches the prototypes in those programs of the service program's procs, then that new signature gets inserted into the compiled program objects. Any existing programs that aren't recompiled will keep the old signatures. Programs with old signatures can only see the original procs and their parms. Programs with new signatures can access any proc that contributed to the new signature. Signatures can be thought of as a kind of "level check". A service program can have multiple "format levels" as long as the procs that make up a signature still exist and still keep the same interfaces. If a signature doesn't change, then there's no need to recompile. If you don't specify signatures with binder language, then the system will generate one automatically. It will generate one similarly to how it generates a record format level ID -- it looks at the exported procs and all of the parms and generates a kind of 'hash' from them. As long as that hash doesn't change, the signature won't change. The DSPPGM command will show the signatures in use for a program; DSPSRVPGM will show signatures for a service program. You can compare the values in a variety of ways if you want to check whether or not programs need to be recompiled. Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    ...the results don't seem to show up in the main program. That part of your question needs some clarification. Can you explain what you mean? Tom
    125,585 pointsBadges:
    report
  • aceofdelts
    If this is too "wordy" then do skim it - details aren't critical. A big piece of my puzzle is that I'm not sure which programs are actually used by this particular online order entry function. The U.S. version has lots of possible variations - the most likely are ... 1 of 2 libraries, 1 of 5 programs, 1 of 2 modules, and finally 1 procedure that shows up in all of the above. Toss in 1 service program, some questionable use of "/COPY", and this vague binder language thing and it's no wonder I was second guessing my every move. With no test environment, I made a simple change in the live procedure (how it handles rounding of fractional units). Updated the 3 most likely programs & waited for the symptom to recur. Rounding still went via the 'old' rules. I know the new code change is good, so why isn't my end result good ? <so this is what I mean by results don't seem to show up> Today, I updated the 4th program. That 5th program is pretty unlikely to be the culprit. We'll see if I get an occurrence this weekend. Bottom line on this question is "Thanks for the great explanation of service programs". That is what I needed to learn (a big chunk anyway). The binder language info is helpful too - I now know that I don't need to start down that path for this issue. Mike L.
    1,720 pointsBadges:
    report
  • TomLiotta
    Note that an activation group may exist in a job. A changed program or service program might not show up until the activation group is reclaimed and reactivated or the job is ended and run again. Tom
    125,585 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