290 pts.
 About CRTPGM command
I have a module which has a copy book in it and when I am creating a main PGM with the command CRTPGM by giving the module name itself as the PGM name and binding the service programs, I am getting an error which says that the procedures which are defined in the copy book are not defined. How to resolve the error? Do I need to add the copybook anywhere? If so could you please let me know where I need to add it?

Software/Hardware used:
iseries/as400
ASKED: February 25, 2013  7:04 AM
UPDATED: February 25, 2013  12:54 PM

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question. Michael Tidmarsh   11,390 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

If you’re using CRTPGM and procedures are copied via a COPY statement, the COPY statement should be irrelevant. The module would have to be previously compiled with CRTRPGMOD, the copied procedures would already be included.
 
The alternative would be that the COPY is only copying procedure prototypes and not copying the procedures at all. That’s a much more likely case. The procedures are most likely in a different module. Assuming that the module (or modules) is also already compiled, then it must be listed as a second (or third or more) module in the MODULE() parameter list.
 
If not listed explicitly, additional modules might be included through inclusion of the service program that contains the procedures in the BNDSRVPGM() parameter; they might be defined with binder language and referenced through the BNDDIR() parameter.
 
If this additional module (or modules) is included in more than one program, then it should be part of a service program.
 
In general, entire procedures shouldn’t be included with COPY statements. So some additional module is probable.
 
Tom

 107,845 pts.