Service Program Catch-22
June 26, 2002 Timothy Prickett Morgan
Hey, Ted:
We have stumbled upon a situation that we do not know how to resolve. We are trying to organize our RPG subprocedures by functional area. For example, all of our string-handling subprocedures go into one service program, while all of our date-handling subprocedures go into another. Other types of subprocedures go into other service programs.
There are two service programs that reference each other. It’s as if a string-handling subprocedure uses a date-handling routine, while a date-handling routine uses a string-handling subprocedure. (That’s not the real situation, but I’ll use it as an illustration.)
The problem is that we can’t create either subprocedure because it needs routines that are found in the other. Do we have to abandon our dreams of getting better organized?
— Andy
No, Andy, you don’t. It will just take a bit of extra work to create the service programs.
Let’s assume you want to create a service program of string-handling routines and a service program of number-handling routines. The string-handling service program contains two subprocedures–STRINGA and STRINGB. The number-handling program contains two subprocedures–NUMA and NUMB. Further, STRINGA calls NUMB; NUMA calls STRINGB.
First, create the modules. Next, create the service programs, specifying OPTION(*UNRSLVREF). This allows you to create the service programs, even though the system cannot link all the necessary subprocedures to their callers, as outlined in this example:
CRTSRVPGM SRVPGM(MYLIB/MYSVNUM) + MODULE(MYSVNUM) + EXPORT(*ALL) + OPTION(*UNRSLVREF) CRTSRVPGM SRVPGM(MYLIB/MYSVSTRING) + MODULE(MYSVSTRING) + EXPORT(*ALL) + OPTION(*UNRSLVREF)
The subprocedures exist, but are not ready for use because of the unresolved references. If you try to use a subprocedure that has an unresolved import, the system issues message MCH3203.
Now create the service programs without OPTION(*UNRSLVREF), as in this example:
CRTSRVPGM SRVPGM(MYLIB/MYSVNUM) + MODULE(MYSVNUM) + EXPORT(*ALL) + BNDSRVPGM(MYSVSTRING) CRTSRVPGM SRVPGM(MYLIB/MYSVSTRING) + MODULE(MYSVSTRING) + EXPORT(*ALL) + BNDSRVPGM(MYSVNUM)
— Ted
Sponsored By RJS SOFTWARE SYSTEMS |
Save TIME AND MONEY with our AS/400-iSeries Report and Data Delivery Systems
Delivering AS/400 reports via email, web, Lotus Notes, Domino or CD. Whether it’s Native AS/400 or PC-based, we have the solution. For a FREE FULLY FUNCTIONAL DEMO CD, please visit our Web site at www.rjssoftware.com. Contact us at 888-RJS-SOFT or email us at sales@rjssoft.com |