IBM AS/400 manual Using the CALLP Operation, Using a Prototyped, Call

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 157
Image 157
Using a Prototyped

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Using

a

Prototyped

Call

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Table

10.

Parameter Passing Options

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Parameter

Option

 

 

 

 

 

Prototyped

 

Not

 

 

 

 

See

Page

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Prototyped

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Compile-time

parameter

 

Yes

 

 

 

 

 

 

 

135

 

 

 

 

checking

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Pass

by

reference

 

Yes

 

 

Yes

 

 

 

135

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Pass

by

value

 

 

 

Yes

(b)

 

 

 

 

 

 

136

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Pass by read-only referenceYes

 

 

 

 

 

 

 

137

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Pass

operational

descriptorsYes

(b)

 

Yes

(b)

 

138

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Pass

*OMIT

 

 

 

 

 

Yes

(b)

 

Yes

(b)

 

139

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Control

parameter

omission

Yes

 

 

Yes

 

 

 

140

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Get number of passed parameY-s

 

 

Yes

 

 

 

141

 

 

 

 

ters

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Disallow

incorrect

parameterYes

 

 

 

 

 

 

 

145

 

 

 

 

length

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Note:

(b)

applies to

bound

procedures

only.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Using a Prototyped

Call

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

A

prototyped

call

is

one for which

there

is

a prototype that is a

 

eter checking. It has a much simpler call interface

and

offers

more

 

example,

using a

 

prototyped

call

you can

call

(with

the

same syntax)

¹

Programs

that

are

on

the

system

at

run

time

 

 

 

 

¹

Exported

procedures

in other modules or service programs that

are

 

 

the same

program

or

service

program

 

 

 

 

 

 

 

 

 

¹Subprocedures in the same module

In RPG,

prototyped calls

are also

known

as Freefree-form -callform

callsrefers.

to

 

the call syntax where the arguments for the

call

are specified

usi

syntax, much like the arguments

for

built-in

functions.

It

contrasts

wi

call,

where

the

arguments

are placed in separate specifications. The

ways

to

make a free-form

call,

depending on

whether

there is

a

ret

to be used. If there

is no return value, use the

CALLP

operation.

and you want to use the

value that is returned, then place the pr

within

an

expression,

for

example, with EVAL. If you

use

CALLP

to

a

that

returns

a

value,

the

return

value

is

ignored.

 

 

 

 

 

Note:

Only

prototyped

procedures

can

return

values;

prototyped

programs

For information on passing prototyped parameters, see “Passing Prototype Parameters” on page 135.

Using the CALLP Operation

You use the CALLP (Call a Prototyped procedure) operation to call a p program or procedure written in any language. The CALLP operation uses lowing free-form syntax:

C

CALLP

NAME{ (PARM1 {:PARM2 ...

}) }

Chapter 10. Calling Programs and Procedures133

Page 157
Image 157
IBM AS/400 manual Using the CALLP Operation, Using a Prototyped, Call