Re: SPL question - how to clip text???
Posted in 1996
In article <4v089u$l80@cssun.mathcs.emory.edu>,
Alan Goodman <alan@dssmktg.com> wrote:
>In version 5.xx online (sorry, but I'm not sure exactly what version), how
>does one go about implementing a function like the 4GL "clipped" function?
>
>What we are doing is converting data from an old table with fixed length
>fields to a new table with varchar fields. Unfortunately, when you read
>a fixed length field into a varchar in an SPL, the varchar is padded with
>trailing spaces to the length of the fixed length field. When this
>varchar is inserted into the varchar field in the new table, the trailing
>spaces are maintained.
>
>We need some way to clip the trailing spaces prior to record insert.
>
>Anybody have any ideas???
Alan,
It kind of depends on how you are unloading/loading the table.
It's not clear to me if you have a specific reason for using SPL.
A couple of ways I have done it:
1) Use the sql unload statement. Run this output file through your
favorite UNIX utility (awk, sed, perl) replacing any number of
occurrences of " |" with "|".
2) Use the 4gl (or Ace) reporting utility to create an appropriate
unload file. You can use the clipped function when doing your
unload this way.
Then use dbload or load to insert the data.
Regards,
Cathy
------------------------------------------------------------------------
Cathy Kipp E-mail: ckipp@verinet.com
Principal Consultant Fort Collins, Colorado, USA
Database Strategies, Inc.
------------------------------------------------------------------------