× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



J.Beckeringh@xxxxxxxxxxxxxxxxxxxxxxxxxx wrote:

I agree that input paramaters SHOULD use CONST, but not specifying it won't cause errors.

Yes, that's why I said stated 'The CONST part isn't strictly necessary' in my message. Thank you for agreeing with me.

As for the 2500 character limit: 'options (*varsize)' pretty much makes the length of the parameter meaningless (in the prootype). Whether you specify 2500, 65535 or 1 makes no difference (I prefer 1).

That's not true. When you code something as CONST, the compiler will sometimes create an intermediate result in memory, and pass the address of that intermediate result.

For example, if you define the prototype as 1A options(*VARSIZE), and then try to pass a VARYING character string to it, the compiler will copy only 1 byte from the VARYING string to an intermediate result, and then it'll only pass that one byte string to the procedure.

So the difference is NOT meaningless in all situations. It's only meaningless if the compiler doesn't have to use an intermediate result.

Also, if you're going to code 1A, then the options(*varsize) is totally meaningless. *varsize only lets you pass variables that are SHORTER than the prototype. You are ALWAYS allowed to pass variables that are longer than the prototype -- you don't need *VARSIZE for that.

But, again, the problem with coding 1A is that if you use an expression, or use a data type that requires conversion, it'll store the result of the expression (or output of the conversion) into a 1A field, and pass that, and you won't get all of the data you were expecting. Always make the parameter the MAXIMUM size, never the minimum size, and you'll avoid that problem.

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.