|
Scott,
You're right (of course; silly me). I missed the combination of CONST and
*VARSIZE.
(BTW: Don't you ever sleep? What time is it over there?)
Joep Beckeringh
rpg400-l-bounces@xxxxxxxxxxxx wrote on 09-04-2008 11:39:57:
> 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.
> --
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.