OPM vs ILE
时间:2016-04-28 ┊ 阅读:3,877 次 ┊ 标签: 编程 , 经验 , 系统
OPM: Original Program Model
ILE: Integrated Language Environment
Versions of RPG prior to RPG IV ILE use what IBM has dubbed the Original Program Model (OPM). OPM's counterpart is ILE (Integrated Language Environment). OPM is characterized by the structure of one source member being compiled into one executable program (figure 1).
ILE on the other hand requires a two-step process to create programs. Source members are first compiled into module objects (type *MOD). For RPG, the command CRTRPGMOD (create RPG module) or PDM option 15 is used. Modules can be thought of as sub-programs. They are validated and compiled machine code, but are not executable. One or more modules must then be bound into an executable program using the CRTPGM (create program) command (figure 2).
Note that modules created using different programming languages may be bound into the same program object. We'll cover the specific procedures for doing this and the advantages that the ILE environment provides in later sections. For now, it is only important to know that this is the structure of ILE programs.
This structure applies, even if the one-step CRTBNDRPG (create bound RPG) command is used to compile the program. In fact, you can think of the CRTBNDRPG command as a "wrapper" around both the CRTRPGMOD and CRTPGM commands. The module is created in library QTEMP and the two-step process is transparent to the user (figure 3)
It is important to keep in mind this hierarchy of ILE programs. Lets say for example that we want to use the WRKPGM command (work with programs) to determine the change date of the source member was used to create a program. If the program is OPM, we can simply display the program's attributes.
On the other hand, if the program is ILE, source members are not directly associated to a program. Instead a source member is used to create a module, and one or more modules are used to create a program. Displaying a program's attributes shows - among other things - the module(s) used to create the program. By displaying the module's attributes (this can all be done through the WRKPGM command) we can determine the source information. Keep in mind that we need to go through this extra step because one ILE program may actually be created from multiple source members.
Also note that the CRTBNDRPG command creates the module in library QTEMP. This seems to imply that once the program is created, the module is no longer needed. This is indeed true. The program object contains a complete copy of the module. The exception to this is when service programs are used. Service programs are a slightly more advanced concept that allows program to be created with references to modules instead of actually making a separate copy of them.
All this information is covered in much more detail in the ILE section. Now that you have a decent understanding of the differences between OPM. The next step is to familiarize yourself with the language differences between RPG III and RPG IV.