Midware Ltd.
|
Sign-up for e-mail notifications
|
Up to this point, we've created a separate source member containing multiple procedure and compiled it into a module. Any exported procedures are now available to other modules.
Using external procedure is exactly the same as using internal procedures. The following short program demonstrates using the IsWorkday and DayOfWeek procedures that we developed.
Because we are using external procedures, we need to use a two-step compile process. First, use PDM option 15 or the CRTRPGMOD command to create a module. This is exactly the same as we did with the procedure source member. Recall that a module is not executable on it's own. The next step is to bind our compiled mainline module with our procedure module. There are two different ways to bind these together - static and dynamic. We'll cover static binding first. CRTPGM commandRecall that an ILE program is actually composed of one or more modules. In our example, it will be composed of two - the module compiled from the mainline code we just wrote, and the module containing the procedures:
The CRTPGM command is used to bind the components together and create an executable program. Enter CRTPGM on a command line and press F4 to prompt it. Enter the name and library of the program you want created. Typically, you will name the program the same as the mainline source member. Next, enter the names of the two modules. Next, we need to tell the CRTPGM command which module gets control when the program is called (ENTMOD). Although this is obvious to us, it is not to the CRTPGM command. The default is the first module listed. Because we specified *NOMAIN in our procedure module, we could not, even if we wanted to, use that as the entry point module. The only other parameter you might have to change is to specificy OPTION(*DUPPROC). This parameter allows duplicate procedure names in the modules. Don't get caught up in this detail right now. This is one of those things that probably could have been handled better by IBM. The CRTPGM program should execute very quickly. If it completes sucessfully, you will have an executable program.
|
Send mail to midware@midwareservices.com
with questions or comments about this web site. Last Modified: September 06, 2000 |