Removing Blanks with COBOL
benidrar
-
blux Posted messages 5044 Registration date Status Moderator Last intervention -
blux Posted messages 5044 Registration date Status Moderator Last intervention -
Hello
How to remove trailing spaces in a string with COBOL
for example 'abcd ' would become 'abcd'
Thank you.
How to remove trailing spaces in a string with COBOL
for example 'abcd ' would become 'abcd'
Thank you.
7 answers
-
Hi,
UNSTRING ... DELIMITED BY ALL SPACES INTO ...
That should work...
See you, Blux"The idiots dare everything. It's even how we recognize them."
-
Thank you, I tried
but apparently it doesn't work!
There are still whitespaces
that I want to only eliminate the whitespaces on the right
for example:
'DE SEVRES '
do not delete the space between 'de' and 'sevres'
See you later -
Ok, so in this case, the only solution is to redefine your input area as a table:
05 toto occurs 200.
10 str pic x.
move tavariable to toto.
And then you make a loop that decrements i from 200 to 1 and you test x(i) until x(i) is different from space. As soon as your condition is true, you copy the rest into another variable (with 'string').
--
See you Blux"The fools, they dare to do anything. It's even how you recognize them"
-
Hello
If at first, you don't know where to put the spaces, it seems difficult!
'DE SEVRES " How can you know that you need to leave a space between DE and
SEVRES???
Once this issue is determined, the rest is solved...
KAIDI -
-
He can only do it if he knows in advance the words (or the lengths) from which he has to remove the spaces!!
-