For Programmers: Free Programming Magazines  


Home > Archive > Cobol > November 2007 > Re: Help with Inspect _src_ replacing all [SPACE]ALPHANUMERIC[SPACE] by space









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Help with Inspect _src_ replacing all [SPACE]ALPHANUMERIC[SPACE] by space
Richard

2007-11-01, 6:55 pm

On Nov 2, 7:29 am, vferr...@alumni.uottawa.ca wrote:
> William M. Klein wrote:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Hey guys!
>
> Well, I tried the suggestion above, and sure enough it worked.
>
> I am sorry for not originally describing the problem very clearly. It
> was somewhere along the lines...
>
> I have a string say- ' big fresh a apple'
> I needed to scrapout the a and replace it with a space, I realize this
> will give me double spaces, but I have a routine later that scrubs off
> additional spaces, which was why I didnt care.


Do it in a loop with UNSTRING .. DELIMITED BY SPACE .. WITH
POINTER .., check each word for being a single character and assemble
the result string with STRING .. WITH POINTER .. (not same pointer of
course).

MOVE 1 TO InP OutP
MOVE SPACES TO OutS
PERFORM UNTIL InS(InP:) = SPACES
UNSTRING InS DELIMITED BY SPACE
INTO Word
WITH POINTER InP
IF ( InS(2:1) NOT = SPACE )
STRING Word DELIMITED BY SPACE
" " DELIMITED BY SIZE
INTO OutS
WITH POINTER OutP
END-IF
END-PERFORM






Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com