The documentation is somewhat vague on Operational Descriptors. But I read
this:
Descriptors are normally accessed directly by a called procedure according
to the semantics of the HLL in which the procedure is written. Once a
procedure is programmed to expect operational descriptors, no further
handling is usually required by the programmer. However, sometimes a called
procedure needs to determine whether the descriptors that it requires are
present before accessing them. For this purpose the following bindable APIs
are provided:
- Retrieve Operational Descriptor Information (CEEDOD) bindable API
- Get String Information (CEEGSI) bindable API
in the Knowledge Center, here:
https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/ilec/apiopd.htm
That seems to me to be saying that the only thing I should need to do with
these API's is to determine if the operational descriptor is present or
not, but that the HLL (in this case RPGLE) should process the operational
descriptor.
So I have a procedure defined with OPDESC, and a Varchar defined with
OPTIONS(*VARSIZE). The Knowledge Center tells me this:
When OPTIONS(*VARSIZE) is specified, the passed parameter may be shorter or
longer in length than is defined in the prototype. It is then up to the
called program or subprocedure to ensure that it accesses only as much data
as was passed. To communicate the amount of data passed, you can either
pass an extra parameter containing the length, or use operational
descriptors for the subprocedure. For variable-length fields, you can use
the %LEN built-in function to determine the current length of the passed
parameter.
Does that mean that all I have to do is use %LEN(*MAX) and it will
interrogate the opdesc to determine the maximum length of the VARCHAR that
was passed? or will %LEN(*MAX) just tell me what I defined as the maximum
length in the procedure interface?
As an Amazon Associate we earn from qualifying purchases.