Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
A user calling a C function from Informix 4GL found that significant trailing spaces in returned strings were being lost, and that LENGTH() on a column set to "12 " returned 2 instead of 4. Replies explained this is expected behaviour: 4GL/Informix pads CHAR variables and columns to their full declared length and ignores trailing blanks, and LENGTH() always reports the clipped length for CHAR and VARCHAR. Suggested workarounds were to use VARCHAR (which preserves trailing blanks on unload) or to return/store the string's real length separately. The poster noted he was on SE rather than OnLine; no further resolution is recorded.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Wish Markwalter — — source: Informix-list mailing list archive (1991-1998)
We are calling a c function from 4GL this function returns a string variable
that may contain trailing spaces that are significant. When 4GL receives
the sting it appears to be "CLIPPING" these trailing spaces. I also tried
using dbaccess with an update statement let colum ="12 ". Then is
selected the length(column) and got 2 rather than 4. Anybody got an idea
what it is doing with the strings?
↪ replying to Wish Markwalter
Mike Aubury — — source: Informix-list mailing list archive (1991-1998)
Informix disregards your trailing spaces and always pads to the length of the
string (or column)
Eg.
define a char(20)
let a="H"
Display ":",a,":"
-> :H :
If you need the length, your best off storing in your database or returning
that too.
On Fri, 03 Sep 1999, Wish Markwalter wrote:
>We are calling a c function from 4GL this function returns a string variable
>that may contain trailing spaces that are significant. When 4GL receives
>the sting it appears to be "CLIPPING" these trailing spaces. I also tried
>using dbaccess with an update statement let colum ="12 ". Then is
>selected the length(column) and got 2 rather than 4. Anybody got an idea
>what it is doing with the strings?
↪ replying to Wish Markwalter
Rudy Fernandes — — source: Informix-list mailing list archive (1991-1998)
I think that this is something to do with the definition of the
variable/column. Varchars treat trailing blanks as significant (e.g when you
unload the table, they persist). Chars discard trailing blanks when unloaded.
The length function always returns the clipped length for chars and varchars.
HTH
Rudy
On Fri, 03 Sep 1999, Wish Markwalter wrote:
>We are calling a c function from 4GL this function returns a string variable
>that may contain trailing spaces that are significant. When 4GL receives
>the sting it appears to be "CLIPPING" these trailing spaces. I also tried
>using dbaccess with an update statement let colum ="12 ". Then is
>selected the length(column) and got 2 rather than 4. Anybody got an idea
>what it is doing with the strings?
↪ replying to Rudy Fernandes
Wish Markwalter — — source: Informix-list mailing list archive (1991-1998)
Rudy Fernandes <rferdy@pathcom.com> wrote in message
news:936396196.236537605@news.pathcom.com...
> I think that this is something to do with the definition of the
> variable/column. Varchars treat trailing blanks as significant (e.g when
you
> unload the table, they persist). Chars discard trailing blanks when
unloaded.
>
> The length function always returns the clipped length for chars and
varchars.
> HTH
> Rudy
>
> On Fri, 03 Sep 1999, Wish Markwalter wrote:
> >We are calling a c function from 4GL this function returns a string
variable
> >that may contain trailing spaces that are significant. When 4GL receives
> >the sting it appears to be "CLIPPING" these trailing spaces. I also
tried
> >using dbaccess with an update statement let colum ="12 ". Then is
> >selected the length(column) and got 2 rather than 4. Anybody got an idea
> >what it is doing with the strings?
>
↪ replying to Rudy Fernandes
Wish Markwalter — — source: Informix-list mailing list archive (1991-1998)
I guess, I should have mentioned that I am using SE rather than ONLINE.
THX
Wish
Rudy Fernandes <rferdy@pathcom.com> wrote in message
news:936396196.236537605@news.pathcom.com...
> I think that this is something to do with the definition of the
> variable/column. Varchars treat trailing blanks as significant (e.g when
you
> unload the table, they persist). Chars discard trailing blanks when
unloaded.
>
> The length function always returns the clipped length for chars and
varchars.
> HTH
> Rudy
>
> On Fri, 03 Sep 1999, Wish Markwalter wrote:
> >We are calling a c function from 4GL this function returns a string
variable
> >that may contain trailing spaces that are significant. When 4GL receives
> >the sting it appears to be "CLIPPING" these trailing spaces. I also
tried
> >using dbaccess with an update statement let colum ="12 ". Then is
> >selected the length(column) and got 2 rather than 4. Anybody got an idea
> >what it is doing with the strings?
>
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.