06-24-2016 05:40 PM
There may be easier ways.
It may be that this is not what you really want. Remember, you are only shifting text over since the length of a character variable is fixed.
You may be better served by the COMPBL function.
WIth all that in mind, here is a way to approach what you asked for:
if string > ' ' then do i=1 to length(string) until (blanks=2);
if substr(string, i, 1)=' ' then blanks + 1;
if blanks=2 then string = substr(string, 1, i-1) || substr(string, i+1);
I also tried looking at CALL SCAN, but didn't find an approach that seemed like it would work.
06-24-2016 11:27 PM
Given the string
where s is a space, do you want
AsBCssD (second space of the string removed)
AsBsCsD (double space replaced by single space) ?
Need further help from the community? Please ask a new question.