Skip to Content
0
Former Member
Sep 22, 2008 at 09:30 AM

REPLACE : want to replace the string

13 Views

Hello All,

I need to replace a word(GO) in a sentence with another word(GONE). these words are stores in the variables var1(6) & var2(6) used the keyword REPLACE for this But I am getting some unwanted blank spaces. I used CONDENE keyword then also one blank space remains. I should not get any unwanted blank space. Please help me.

Data : var1(6) type c.

Data : var2(6) type c.

Data : var3(15) type c.

Data : len type i.

var1 = 'GO'.

var2 = 'GONE'.

var3 = 'ABCDGOEFGH'

len = strlen(var1).

REPLACE var1LENGTH len WITH var2 INTO var3.

Then the new sentence is coming like

ABCDGONE EFGH

I used CONDENSE then again it is coming like.

ABCDGONE EFGH

I need the sentence like ABCDGONEEFGH

Regards,

Lijo John