I have tried a lot and am not able to achieve this.
Using DFSORT SORT step, I have created an xml output file. But if my output file had any of these characters '&', '<', '>', ''' (single quotes) or '"' (double quotes) then the xml fails to open.
Option 1:
If my data is wrapped between '<![CDATA[' and ']]>' tags, then I won't have a problem. But when I did this, the '[' and ']' characters came out as junk characters and xml failed again.
SORT FIELDS=COPY
OUTFIL FNAMES=MYEXT,REMOVECC,
BUILD=(4:C'<Row>',/,
5:C'<Cell><Data><![CDATA[',
1,20,JFY=(LENGTH=20,SHIFT=LEFT),
C']]></Data></Cell>',/,
4:C'</Row>')
This is what I get:
<!ÂCDATAÂsome data ÙÙ>
Option 2:
Instead of using CDATA tags, there will not be any problem, if I replaced:
'&' with '&'
'<' with '<'
'>' with '>'
''' with '''
'"' with '"'
I tried using CHANGE= option, but if I do not know the position of these characters in my file (say, these characters can be anywhere from 1 to 20th position in my input file), then how do I achieve this?
Can any of you help me with any of my options (or is there any new option for me)?
Much appreciated.