IBM AS/400 Examples of Free-Form Call, Passing Prototyped Parameters, Parameter Passing Styles

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 159
Image 159
Passing Prototyped Parameters

Passing Prototyped Parameters

Examples of Free-Form Call

For examples of using the CALLP operation, see:

¹ Figure 22 on page 41

¹ Figure 43 on page 97

¹ Figure 105 on page 212

¹ Figure 70 on page 144

¹Figure 117 on page 242

For examples of calling by using an expression, see:

¹ Figure 4 on page 10

¹ Figure 19 on page 39

¹ Figure 38 on page 79

¹Figure 105 on page 212

Passing Prototyped Parameters

When you pass prototyped parameters:

¹The compiler verifies, when compiling both the caller and the calle parameter definitions match, provided as both are compiled using t type.

¹ Fewer specifications are needed, since you do not need the PARM

This section discusses the various options that are available when d typed parameters, and the impact of these options on the call inter

Parameter Passing Styles

Program calls, including system API calls, require that parameters be reference. However, there is no such requirement for procedure cal allows three methods for passing and receiving prototyped parameters:

¹By reference

¹By value

¹By read-only reference

Parameters that are not prototyped may only be passed by referenc

Passing by Reference

The default parameter passing style for ILE RPG is to pass by ref quently, you do not have to code any keywords on the parameter de the parameter by reference. You should pass parameters by refere dure when you expect the callee to modify the field passed. You pass by reference to improve run-time performance, for example, when large character fields. Note also that parameters that are passed program calls can only be passed by reference.

Chapter 10. Calling Programs and Procedures135

Page 159
Image 159
IBM AS/400 manual Examples of Free-Form Call, Passing Prototyped Parameters, Parameter Passing Styles, Passing by Reference