I think maybe what the manual is telling you is that normally the called program/procedure makes use of the operational descriptors - for example to provide the value for %Parms.

The scenario you describe is somewhat unusual. Mostly because if the proto is described as varchar then even with an opDesc you would have problems if a large field were passed as it would need a 4 byte length header not a two. Must do some checking on that because it doesn't make sense.

As to %Len(fieldname) - it will give you the length passed. You would use the CEE APIs to interrogate how big it could have been. Really only of any use when you intend to change the value in the field.

If you could explain why you are using this rather odd combination and what you are trying to do we could offer alternatives.

OpDesc is not used that often partly because the implementation is incomplete and partly because different languages provide different levels of descriptors by default.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Dec 19, 2018, at 2:11 PM, Mark Murphy <jmarkmurphy@xxxxxxxxx> wrote:

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?
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.