Re: string manipulation in SPL
Posted in 1994
jparker@hpbs3645.boi.hp.com (Jack Parker) writes:
Clipping and using variables in a subscript (eg: var2[x,y]) are serious
omissions in SPL, IMO. I think your problem can be solved by defining
everything as VARCHAR, which seems to take care of the clipping since a
NULL gets appended to the end of the character string. I'm unsure if
the database columns need to be VARCHAR; you may need to SELECT INTO a
TEMP TABLE of VARCHARS first.
=======================================================================
Dennis J. Pimple dennisp@informix.com Opinions expressed
Senior Consultant -------------------- are mine, and do not
Informix Software Inc Voice: 303-850-0210 necessarily reflect
Denver Colorado USA Fax: 303-779-4025 those of my employer.
>A new topic for me. Any pointers?
>Essentially I am:
>create procedure get_strg(var1 char(18), var2 char(8), var3 char(18))
>returning VARCHAR(255);
>DEFINE txt_strg VARCHAR(255);
>DEFINE var4 CHAR(8);
>LET txt_strg='';
> FOREACH
> SELECT variable4
> INTO var4
> FROM table
> WHERE variable1 = var1
> AND variable2 = var2
> AND variable3 = var3
> ORDER BY variable4
># Los problem:
>LET txt_strg = txt_strg || varaible4
>end foreach;
>RETURN txt_strg;
>end procedure;
>I cannot seem to clip. I keep getting the full 255 characters in txt_strg
>which makes appending the second variable moot. I've considered writing a
>sub procedure, but if it always returns 255 characters, whats the point. I
>also don't seem to be able to subscript. TFM is of course a great help.
>j.
>_____________________________________________________________________________
>Jack Parker |
>Hewlett Packard, BSMC Boise, Idaho, USA| He who talks most, talks least.
>jparker@hpbs3645.boi.hp.com |
>_____________________________________________________________________________
> Any opinions expressed herein are my own and not those of my employers.
>_____________________________________________________________________________