Re: SPL Bug?
Posted in 2008
It gets even weirder. There are three loops building separate delimited
lists of URLs using the same query with different filter values. So I
decided to move the loops into a function with the one loop and the
replaceable parameters that I could just call three times to build one of
the three concatenated strings and return it each call.
Well assigning the replaceable parameters was failing so then I built the
query string with the filter values concatenated in. That worked, but the
first call to the function was getting the same -661 error trying to assign
to the caller's lvarchar and status var. Now here's the REALLY WIERD part -
on a whim I decided to add a third variable to the assignment, so even
though the function I'm calling returns two values, am lvarchar and an int,
I called with three return vars and I changed the LET to an EXECUTE FUNCTION
... INTO, so
LET lvarchar_var, int_var = func_call( arg1, arg2, arg3 );
became:
EXECUTE FUNCTION func_call( arg1, arg2, arg3 ) INTO lvarchar_var, int_var,ignored_int_var;
I did this just for the first of the three calls to the function, the other
two I left alone. VOILA! everything works now. SCARY!
IDS 11.50 still needs a bit of work before it's ready for prime time!
Art
On Thu, Jun 26, 2008 at 11:14 PM, Art Kagel <art.kagel@gmail.com> wrote:
> Version: IDS 11.50.UC1X2
> Platform: 2.6.18
>
> Has anyone seen this one yet? Long complex SPL function with dynamic SQL.
> Somewhere in the function as assign the contents of a variable (type
> LVARCHAR(200)) to another var (type LVARCHAR(6000)) to append to the var.
> The assignment returns a -661 error:
>
> -661 Number of variables does not match number of values returned.
>
> The number of variables on the left side of a LET statement does not
> match the number of values on the right side.
>
> So, in pseudo code:
> DEFINE final LVARCHAR(6000);
> DEFINE hold LVARCHAR(200);
> LET final = '';
> LOOP
> FETCH acurs INTO hold;
> LET final = final || hold; -- Gets -661 error exiting the SPL function.
> ...
> END LOOP
>
> Tried an intermediate var, it fails in that assignment instead. Tried
> renaming the var I'm fetching into, no change. Since the string being
> assigned contains a URL, though there might be strange characters causing
> the problem, so I tried replacing the assignment of the entire var with a
> loop that appends each character one at a time using SUBSTR(hold, pos, 1)
> looping on pos from 1 to length(rtrim(hold)). It fails with the same -661
> error on assigning the first character, the 'h' from 'http:' at the start of
> the URL.
>
> I had this the other day (same function, different assignment). Converting
> several hard coded SQL statements into dynamic ones got me past this, now
> its back. I'll report this one in the AM, but it would be good if someone
> else has seen it before.
>
> --
> Art S. Kagel
> Oninit (www.oninit.com)
> IIUG Board of Directors (art@iiug.org)
>
> Disclaimer: Please keep in mind that my own opinions are my own opinions
> and do not reflect on my employer, Oninit, the IIUG, nor any other
> organization with which I am associated either explicitly or implicitly.
> Neither do those opinions reflect those of other individuals affiliated with
> any entity with which I am affiliated nor those of the entities themselves.
>
--
Art S. Kagel
Oninit (www.oninit.com)
IIUG Board of Directors (art@iiug.org)
Disclaimer: Please keep in mind that my own opinions are my own opinions and
do not reflect on my employer, Oninit, the IIUG, nor any other organization
with which I am associated either explicitly or implicitly. Neither do those
opinions reflect those of other individuals affiliated with any entity with
which I am affiliated nor those of the entities themselves.