First off, the prototype source goes into a source member (GETNUM_P) of its own and doesn’t have to be compiled, the /COPY is an instruction to the compiler to copy the source in at compilation time.
Usually copy source members go into source file QCPYSRC and the statement would be:
If the source file isn’t specified then the copy source member should be in the same source file as the module it’s being used in.
The module GETNUM is for a service program, so to compile using PDM use option 15 (=Create Module) or the CRTRPGMOD command if you’re doing it manually.
Once the module has compiled, you create the service program using the CRTSRVPGM command. You will probably need to make sure that the EXPORT parameter is *ALL.
The module for the test program is compiled, again, using option 15 in PDM or the CRTRPGMOD command. When this has compiled, you then use the CRTPGM command to create the ILE program.
On the CRTPGM command you will need to specify the service program that you want to use, and this can be done in a variety of ways. For the test you could use:
A better way, especially where there is more than one module and/or service program is to use binding directories.
A binding directory is a list of modules and service programs to be bound together to make a program. For this example, I would create a binding directory with the same name as the program:
And then add the modules/service program to it:
ADDBNDDIRE BNDDIR(LIBRARY/TESTPGM) OBJ((*LIBL/TESTPGM *MODULE))
ADDBNDDIRE BNDDIR(LIBRARY/TESTPGM) OBJ((*LIBL/GETNUM *SRVPGM))
You can also use the WRKBNDDIR and WRKBNDDIRE commands to work with binding directories.
Using the binding directory, the CRTPGM command would now be:
All the best