IBM AS/400 Frozen Dessert Maker User Manual


 
Passing Prototyped Parameters
are then built by the calling procedure and passed as hidden parameters to the
called procedure. Operational descriptors will not be built for omitted parameters.
You can retrieve information from an operational descriptor using the ILE bindable
APIs Retrieve Operational Descriptor Information (CEEDOD) and Get Descriptive
Information About a String Argument (CEESGI).
Note that operational descriptors are only allowed for bound calls. Furthermore, for
non-prototyped calls, an error message will be issued by the compiler if the 'D'
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 Service
Program” on page 94. The example consists of a service program which converts
character strings which are passed to it to their hexadecimal equivalent. The
service program uses operational descriptors to determine the length of the char-
acter string and the length to be converted.
Omitting Parameters
When calling a procedure, you may sometimes want to leave out a parameter. It
may be that it is not relevant to the called procedure. For example, this situation
might arise when you are calling the ILE bindable APIs. Another reason might be
that you are calling an older procedure that does not handle this particular param-
eter. If you need to omit a parameter on a call, you have two choices:
| 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 you check to
| see if a parameter has been omitted. In either case, an omitted parameter cannot
| be referenced by the called procedure; if it is, unpredictable results will occur. So if
the called procedure is designed to handle different numbers of parameters, you
will have to check for the number of parameters passed. If *OMIT is passed, it will
'count' as a parameter.
Chapter 10. Calling Programs and Procedures 139