IBM AS/400 manual Omitting Parameters, Passing Prototyped Parameters, the length of the parameter

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 163
Image 163
*Len returns a 10-digit integer value. The parameter

Passing Prototyped Parameters

are then built by the calling procedure and passed as hidden para called procedure. Operational descriptors will not be built for omitt

You can retrieve information from

an operational descriptor

using the

APIs Retrieve Operational Descriptor Information (CEEDOD) and Get Descr

Information

About a String Argument (CEESGI).

 

 

 

 

 

 

Note that

operational descriptors

are

only

allowed

for

bound

calls. Fu

non-prototyped calls, an error message will

be

issued

by

the

compiler

operation

code extender is specified

on

a

CALL

operation.

 

Figure 66 shows an example of the keyword OPDESC.

*-------------------------------------------------------------

*Len returns a 10-digit integer value. The parameter

*is a character string passed by read-only reference.

*Operational descriptors are required so that Len knows

*the length of the parameter.

*OPTIONS(*VARSIZE) is required so that the parameter can

*be less than 32767 bytes.

 

*-------------------------------------------------------------

 

D Len

 

 

PR

10I 0 OPDESC

D

 

 

 

 

 

32767A

OPTIONS(*VARSIZE) CONST

 

 

 

 

Figure

66.

Requesting Operational Descriptors for a Prototyped Procedure

For an

 

example

of

how to use operational descriptors see “Sample Serv

Program”

on

page 94.

The example

consists of a service program which

character

strings

which are passed to it to their hexadecimal equi

service

program uses

operational descriptors to determine the length

acter

string

and

the

length to

be converted.

Omitting Parameters

 

When

 

calling

a

procedure,

you may sometimes want

to

leave

out

a

par

 

may

 

be that it is not relevant

to the called procedure. For

exampl

 

might

 

arise

when

you

are

calling

the

ILE

bindable APIs.

 

Another reas

 

that

 

you

are calling an older procedure

that does

not

handle

this

 

eter.

If

 

you need to omit a parameter on a call, you have two c

¹

Specify

 

OPTIONS(*OMIT)

and

pass

*OMIT

 

 

 

 

 

 

 

 

¹

Specify

 

OPTIONS(*NOPASS) and do not pass the parameter.

 

 

 

 

 

The

 

primary

difference

between

the

two

methods

has

to

 

do with

how

see

 

if a parameter has been omitted. In either case, an omitted

be

referenced

by

the called

procedure; if it is, unpredictable

 

the

called

procedure is designed to handle different

numbers

of

pa

 

will

 

have to check for the number of

parameters

passed.

If

*OMIT

 

'count'

as

a

parameter.

 

 

 

 

 

 

 

 

 

 

 

Chapter 10. Calling Programs and Procedures139

Page 163
Image 163
IBM AS/400 manual Omitting Parameters, Passing Prototyped Parameters, Len returns a 10-digit integer value. The parameter