09-22-2008 10:30 AM
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
09-22-2008 10:36 AM
hi,
you have to use CONDENSE var3 NO-GAPS . (CONDENSE alone will reduce only to one space.)
hope this helps
ec
09-22-2008 10:33 AM
09-22-2008 10:36 AM
hi,
you have to use CONDENSE var3 NO-GAPS . (CONDENSE alone will reduce only to one space.)
hope this helps
ec
09-22-2008 10:37 AM
HI,
Plz try and Check the Code.
Condense (VAr1).
Condense(VAr2).
Replace Var1 withe Var2 into Var 3.
Regards
Sumit Agarwal
09-22-2008 10:38 AM
hi,
check the data type length of variables..than it is coming right..
Data : var1(2) type c.
Data : var2(4) type c.
Data : var3(12) type c.
Data : len type i.
Regards,
Deepthi.
09-22-2008 10:39 AM
09-22-2008 10:44 AM
Dear Friends,
I cannot restrict the variable length. The data length will be keep changing as per the situation.
eg.
va1 = 'Please raise the Travel Req'
var2 ='Please raise an Emergency Travel Req'
and some space should be there. I dont want to chage that spaces also.
Regards,
Lijo
09-22-2008 11:26 AM
Data : var1(3) type c.
Data : var2(12) type c.
Data : var3(40) type c.
Data : len type i.
var1 = 'the'.
var2 = 'an Emergency'.
var3 = 'Please raise the Travel Req'.
len = strlen( var1 ).
REPLACE var1 LENGTH len WITH var2 INTO var3.
09-22-2008 10:41 AM
Hi,
I have changed the code written by you.
Check this-
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 var1 LENGTH len WITH var2 INTO var3.
condense var3 no-gaps.
write:var3.
09-22-2008 10:44 AM
Hi,
Plz check your variable declaration part :
Data : var1(2) type c.
Data : var2(4) type c.
Data : var3(12) type c.
Data : len type i.
or
Use
" CONDENSE var3 No-GAPS. "
thanx.
09-22-2008 10:47 AM
Hi,
Try this:
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 var1 LENGTH len WITH var2 INTO var3.
condense var3 no-gaps.
write var3.
Regards,
Surinder