Programs and procedures are the two basic units of execution on iSeries™.
Programs come in two flavors: the original program model (OPM) and the Integrated Language Environment® (ILE). MI programs can be created only for the OPM environment. If you require ILE support in the development of your applications, use ILE C, ILE COBOL, or ILE RPG and the languages' built-in MI support.
In the OPM environment, a program is comprised of two basic components: the object definition table (ODT) and an instruction stream. In the case of MI programs, the program is created using the Create Program (QPRCRTPG) API.
The ODT is the means for defining all objects (program data elements) that are referred to by the MI instruction stream. An ODT definition of an object does not actually allocate storage for the object. It does, however, define when and how much storage is to be allocated and also the attributes of the storage (for example, the data type of the object). The ODT is built from the declare (DCL) statements found in the source used to create a program. Because DCL statements are actually instructions to the QPRCRTPG API and not MI instructions, they are defined in the QPRCRTPG API.
The types of objects that can be declared are:
The instruction stream defines the set of operations to be performed by the program. The instruction stream is built from the MI instructions found in the source used to create a program. The various MI instructions that you can use are defined in the iSeries Machine Interface instructions.
Within the source used to create a program, there is a type of statement called a directive. Directive statements can be found in the QPRCRTPG API and are used to do the following:
The program end (PEND) directive must be the last statement in the source, and it functions as a return external (RTX) MI instruction if logically processed as part of the instruction stream.
Noncomment source statements (declares, instructions, and directives) are always ended by a semicolon (;). Comments always begin with a slash and asterisk (/*) and end with an asterisk and slash (*/).