IBM manual Program/Procedure Call Overview, ILE RPG for AS/400 Programmers Guide

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 156
Image 156

Program/Procedure Call Overview

Sometimes you may not be sure of the exact format of the data t passed to you. In this case you may request that operational de passed to provide additional information regarding the format of the parameters.

¹Number of parameters

In general, you should pass the same number of parameters as expe the called program or procedure. If you pass fewer parameters t expected, and the callee references a parameter for which no da passed, then the callee will get an error.

¹Passing less data

If you pass a parameter

and

you

pass too little

data,

your

appli

work

correctly.

If

changing

the

parameter,

you

may

overwrite

storag

the

parameter,

you

may

misinterpret

the

parameter.

By

prototyping

t

eter, the

compiler

will check

to

see that

the

length

is

appropriat

eter.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

If

the

callee

has

indicated

(through

documentation

or

through

that

that a parameter can be shorter than

the

maximum length,

you

can

s

shorter

parameters.

(Note, however, that the called

procedure

must

in a

way

to handle

less

data

than

required.)

 

 

 

 

 

 

¹Order of evaluation

There

is no guaranteed order for evaluation

of parameters on a pro

This

fact

may

be important, if a parameter

occurs

more than once

eter

list,

and

there is the possibility of

side

effects.

¹Interlanguage call considerations

Different HLLs support different ways of representing data as well ways of sending and receiving data between programs and procedures general, you should only pass data which has a data type common to calling and called program or procedure, using a method supported by

Table 10 on page 133 associates the above considerations with the two parameters: prototyped or non-prototyped.

132 ILE RPG for AS/400 Programmer's Guide

Page 156
Image 156
IBM manual Program/Procedure Call Overview, ILE RPG for AS/400 Programmers Guide