IBM Version 4 manual Parameter Passing, Value of the data object is placed directl, Parameter List

Models: Version 4

1 505
Download 505 pages 30.92 Kb
Page 27
Image 27

ters (A through Z,

0 through 9,

$,

#,

@,

),

or

_). The system uses

as is, and it does

not change

or

check

the

object

name

before

lo

This improves the performance of

the

API. An

incorrect

name

usually

re

Object not found error.

 

 

 

 

 

 

 

 

 

 

Parameter Passing

With the exception of the

UNIX-type APIs, the standard protocol

is

pointer that points to

the

information that

is being passed. (This

is

as pass-by-reference.)

This

is the convention

automatically used by

CL,

COBOL compilers. If you are using a language that supports pointers, ensure that these conventions are followed. Refer to the appropriate

umentation

for

instructions.

Refer

to “Selecting

the High-Level

Language

on

 

page 2-3

for

a table

that discusses

the

high-level

languages.

 

In

 

an

OPM

or

ILE

 

parametercall,

a

is

an

expression

that

represents

a

value

the

calling

application

passes

to

the API specified in the call. HLL

the

following

methods

for

passing

parameters:

 

 

 

 

 

 

 

by

 

value,

directly

 

 

The value of the data object is placed directl

 

 

 

 

 

 

 

 

parameter

list.

 

 

 

 

 

 

 

 

by

 

value,

indirectly

 

 

The

value

of

the data object is copied to a

 

 

 

 

 

 

 

 

location. The

address

of

 

the

copy

(a pointer)

is

 

 

 

 

 

 

 

 

into the parameter list. By value, indirectly is

 

 

 

 

 

 

 

 

explicitly

by

the application programmer. It is d

 

 

 

 

 

 

 

 

the

operating

system

at

run

time.

 

 

 

 

by

 

reference

 

 

 

 

 

A

pointer

to

the data object is placed

into

th

 

 

 

 

 

 

 

 

list. Changes made by the

called API to

the par

 

 

 

 

 

 

 

 

are reflected in the calling application.

 

 

 

Figure 2-4 illustrates these parameter passing styles. Not all

HLL

langua

support

all

styles.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

By

value,

directly

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

a copy of argument

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

By

value,

indirectly

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

pointer

 

 

 

 

 

 

 

 

a copy of argument

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

By reference

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

pointer

the actual argument

RV2W1027-1

Figure 2-4. Methods for Passing Parameters

HLL semantics usually determine when data is passed by value and whe passed by reference. For example, ILE C passes and accepts paramet value, directly, while for OPM and ILE COBOL and OPM and ILE RPG param are usually passed by reference. You must ensure that the calling p

Chapter 2. Getting Started with2-7APIs

Page 27
Image 27
IBM Version 4 Parameter Passing, Value of the data object is placed directl, Parameter List, Langua, Support All Styles