Chapter 7. Machine Interface Programming
This chapter is for programmers interested in creating machine interface (MI) pro-
grams. While some MI instructions are discussed within the context of how to
develop MI programs, this chapter makes no attempt to review the full range of MI
instructions. The goal of this chapter is to provide a sufficient base of knowledge
so that you can begin to use the MI language. After reading this chapter, you
should be able to develop, create, run, and debug an AS/400 MI program. When
reading this chapter, you will need access to the
System API Reference
,
SC41-5801, and the
Machine Interface Functional Reference
, SC41-5810, because
these two books are referred to extensively.

Machine Interface Instructions—Introduction

Programs and procedures are the two basic units of execution on the AS/400. Pro-
grams come in two flavors: the original program model (OPM) and the Integrated
Language Environment (ILE). MI programs can be created only for the OPM envi-
ronment. If you require ILE support in the development of your applications, use
ILE C and its 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 pro-
grams, the program is created using the Create Program (QPRCRTPG) API. This
API is documented in the
System API Reference
.
The ODT is the means for defining all objects1 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:
Scalar
Pointer
Machine space pointer
Operand list
Instruction definition list
Exception description
Space
Constant
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
Machine Interface Functional Reference
.
1The term
objects
in this chapter refers to program data elements and not OS/400 object types such as a *FILE, *PGM, *USRPRF,
and so on.
ď›™ Copyright IBM Corp. 1997 7-1