Program/Procedure Call Overview
Chapter 10. Calling Programs and Procedures
In ILE, it is possible to call either a program or procedure. Furthermore, ILE RPG
provides the ability to call prototyped or non-prototyped programs and procedures.
(A prototype is an external definition of the call interface that allows the compiler to
check the interface at compile time.)
The recommended way to call a program or procedure is to use a prototyped call.
The syntax for calling and passing parameters to prototyped procedures or pro-
grams uses the same free-form syntax that is used with built-in functions or within
expressions. For this reason, a prototyped call is sometimes referred to as a 'free-
form' call.
Use the CALL or CALLB operations to call a program or procedure when:
You have an extremely simple call interface
You require the power of the PARM operation with factor 1 and factor 2.
You want more flexibility than is allowed by prototyped parameter checking.
This chapter describes how to:
Call a program or procedure
Use a prototyped call
Pass prototyped parameters
Use a fixed-form call
Return from a program or procedure
Use ILE bindable APIs
Call a Graphics routine
Call special routines
Program/Procedure Call Overview
Program processing within ILE occurs at the procedure level. ILE programs consist
of one or more modules which in turn consist of one or more procedures. An ILE
RPG module contains an optional main procedure and zero or more subproce-
dures. In this chapter, the term 'procedure' applies to both main procedures and
subprocedures.
An ILE 'program call' is a special form of procedure call; that is, it is a call to the
program entry procedure. A program entry procedure is the procedure that is desig-
nated at program creation time to receive control when a program is called. If the
entry module of the program is an ILE RPG module, then the main procedure of
that module is called by the program entry procedure immediately after the program
is called.
This section contains general information on:
Program call compared to procedure call
Call stack (or how a series of calls interact)
Copyright IBM Corp. 1994, 1999 127