Using a Prototyped Call

A prototyped call is one for which there is a prototype that is available to do parameter checking. The prototype may be explicitly specified, or it may be implicitly generated by the compiler from the procedure interface, if the procedure is specified in the same module as the call. A prototyped call has a much simpler call interface and offers more function. For example, using a prototyped call you can call (with the same syntax):

In RPG, prototyped calls are also known as free-form calls. Free-form call refers to the call syntax where the arguments for the call are specified using free-form syntax, much like the arguments for built-in functions. It contrasts with fixed-form call, where the arguments are placed in separate specifications. There are two ways to make a free-form call, depending on whether there is a return value that is to be used. If there is no return value, use the CALLP operation. If there is one, and you want to use the value that is returned, then place the prototyped procedure within an expression, for example, with EVAL. If you use CALLP to a procedure that returns a value, the return value is ignored.

Note:
Only prototyped procedures can return values; prototyped programs cannot.

You can optionally code parentheses on procedure calls that do not have any parameters. This makes it easier to distinguish procedure calls from scalar variable names.

For information on passing prototyped parameters, see Passing Prototyped Parameters.



[ Top of Page | Previous Page | Next Page | Contents | Index ]