Page 1 of 1

INSPECT clause search

PostPosted: Fri May 10, 2013 11:25 am
by luckyboyroh
hi friends,

is it possible to use inspect clause to replace characters of different lengths?

ex: INSPECT WS-DESC REPLACING ALL '&' BY '&'
WS-DESC:johnson & johnson

i want it to be modified as :
WS-DESC: johnson & johnson.

Wen i try, it is showing compiler error,"REPLACING" operand "'&'" was not the same length as the "BY" operand "'&'"

is there any other way to acheive this? coz i am trying to parse in xml and it doesn allow.

XML has a special set of characters that cannot be used in normal XML strings. These characters are:
Character should be replaced with
& &
< &lt;
> &gt;
" &quot;
' &#39;

Re: INSPECT clause search

PostPosted: Fri May 10, 2013 12:02 pm
by Pandora-Box
You could achieve this by using UNSTRING delimited by '&'

and then string back the value '&amp' with the needed data

Re: INSPECT clause search

PostPosted: Fri May 10, 2013 1:47 pm
by BillyBoyo
You should read closely, and believe, the compiler messages. For first step for a fuller understanding is then the COBOL manuals, the Language Reference first, and then the Programming Guide. They are available through IBM on the web, and there is a link at the top and bottom of the page here.

What XML processing are you doing?