IBM Version 4 Universal Remote User Manual


 
Within the source used to create a program, there is a type of statement called a
directive. Directive statements are defined in the
System API Reference
in the
section discussing the QPRCRTPG API and are used to do the following:
Control the formatting of the output listing, such as the title, page ejection, and
so on.
Define entry points within the program for external and internal calls.
Define breakpoints within the program to associate a breakpoint name to a par-
ticular MI instruction.
Specify the end of the program source.
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 (ᑍ/).
Writing an MI Program—Example
This topic shows how to write a simple MI program that receives two packed-
decimal parameters and returns the larger value through a third parameter. This
program demonstrates how to do the following:
Define an external entry point
Define and access parameters
Use conditional branching
Assign a value to a scalar object
End the program
Note: When reviewing this source code, unless noted otherwise, you can find all
directive and DCL statements in the
System API Reference
; all other state-
ments are in the
Machine Interface Functional Reference
. While this
chapter attempts to discuss the intent of a statement, refer to the applicable
reference book for specific details.
Setting the Entry Point
First the program, MI01 in this example, needs an ENTRY directive statement to
designate its external entry point. The following directive declares an unnamed (the
*) external (the EXT) entry point, which is called with a parameter list corresponding
to PARM_LIST (defined later in the source code):
ENTRY ᑍ (PARM_LIST) EXT;
Setting the Declare Statements
OS/400 programs typically pass parameters by reference as part of the high-level
language (HLL) calling convention. Because OS/400 programs pass by reference
(that is, address and not value), the program also needs to define three space
pointers (how storage is referenced) to represent the three parameters being
passed. This is accomplished by the following directives:
DCL SPCPTR ARG1@ PARM;
DCL SPCPTR ARG2@ PARM;
DCL SPCPTR RESULT@ PARM;
7-2 System API Programming V4R1