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.
Hendrick wanted a replace() function like SQL's inside a 4GL data dump. Jonathan Leffler suggested LET idno[1,5] = 'XXXXX' for fixed positions and the IIUG archive for search functions. Another poster suggested selecting replace() into a temp table then unloading, or using foreach with substring assignment. Paul Watson said V9/10 can use the regexp datablade.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
I have an exsisting 4GL program which does a simple data dump, but I
would like to manipulate one feild in the dump by using the replace
function as in SQL. But this doesn't work within 4GL. Does any one have
a workaround?
replace(idno, substr(idno,1,5), 'XXXXX')
Thanks
Hendrick wrote:
> I have an exsisting 4GL program which does a simple data dump, but I
> would like to manipulate one feild in the dump by using the replace
> function as in SQL. But this doesn't work within 4GL. Does any one have
> a workaround?
>
> replace(idno, substr(idno,1,5), 'XXXXX')
LET idno[1,5] = 'XXXXX'
It's harder when you have to deal with a variable offset - such as
trying to replace 'feild' with 'field'. In SPL, you're stuck with
constant subscripts. IIRC, in I4GL, you are not (one reason why the
SPL limitation was so frustrating). But the search part is hard(er).
Poke around the IIUG Software Archive; there are most likely some
functions in there to do the job.
Hendrick wrote:
> I have an exsisting 4GL program which does a simple data dump, but I
> would like to manipulate one feild in the dump by using the replace
> function as in SQL. But this doesn't work within 4GL. Does any one have
> a workaround?
>
> replace(idno, substr(idno,1,5), 'XXXXX')
>
>
> Thanks
you can do two things:
1) if you need to use the unload command then this can be achieved
with:
--
select replace(idno, substr(idno,1,5), 'XXXXX') from idtable into temp
t1;
unload to idtable.unl select * from t1
--
not good if you have a large amount of data
2) use fetch/foreach into "variable", manipulate it using "let variable
= "XXXXX", variable[6,length of variable]" then output to report
hope this helps, cheers!
"Jonathan Leffler" <jonathan.leffler@gmail.com> wrote in message
news:1151549904.233452.76870@j72g2000cwa.googlegroups.com...
> Hendrick wrote:
>> I have an exsisting 4GL program which does a simple data dump, but I
>> would like to manipulate one feild in the dump by using the replace
>> function as in SQL. But this doesn't work within 4GL. Does any one have
>> a workaround?
>>
>> replace(idno, substr(idno,1,5), 'XXXXX')
>
> LET idno[1,5] = 'XXXXX'
>
> It's harder when you have to deal with a variable offset - such as
> trying to replace 'feild' with 'field'. In SPL, you're stuck with
> constant subscripts.
↪ replying to Hendrick
Paul Watson — — source: Usenet: comp.databases.informix
If you are on V9/10 then you can install the regexp datablade
Cheers
Paul
"Hendrick" <hendrickq@hotmail.com> wrote in message
news:1151531900.970313.109390@y41g2000cwy.googlegroups.com...
>I have an exsisting 4GL program which does a simple data dump, but I
> would like to manipulate one feild in the dump by using the replace
> function as in SQL. But this doesn't work within 4GL. Does any one have
> a workaround?
>
> replace(idno, substr(idno,1,5), 'XXXXX')
>
>
> Thanks
>
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.