Page 1 of 1

XML GENERATE TAGS

PostPosted: Mon Apr 08, 2013 11:47 am
by luckyboyroh
Hi ,

My requirement is need to append XML tags and then send data.

I have defined a copybook with required field tags. I use XML GENERATE to generate the tags in xml format in cobol (i.e) this will append start and end tags as per copybook defined variable.

for example
Copybook field name :side
Output after using XML generate: <side>2</side>

But, for few field, i dont want the same start tag to be appended at end.

like,
currently using the above mentioned logic fileds are populated as below,

<reference-id1-type>ABCD</reference-id1-type>
<reference-id1>123456</reference-id1>
<reference-id2-type>EFGH</reference-id2-type>
<reference-id2>12345677</reference-id2>
<reference-id3-type>IJKL</reference-id3-type>
<reference-id3>12345667</reference-id3>
<reference-id4-type>MNOP</reference-id4-type>
<reference-id4>1111111</reference-id4>
<reference-id5-type>RSTU</reference-id5-type>
<reference-id5>1234455678</reference-id5>

but i want it to be populated in below way.....

<referenceIDGroup>
<referenceID referenceIDType="ABCD">123456</referenceID>
<referenceID referenceIDType="EFGH">12345677</referenceID>
<referenceID referenceIDType="IJKL">12345667</referenceID>
<referenceID referenceIDType="MNOP">1111111</referenceID>
<referenceID referenceIDType="RSTU">1234455678</referenceID>
</referenceIDGroup>

is there any way to populate it this way? pls let me know your suggestions.

Thanks

Re: XML GENERATE TAGS

PostPosted: Mon Apr 08, 2013 12:00 pm
by enrico-sorichetti
pls let me know your suggestions.

start posting to the right forum section COBOL in this case :ugeek:

Re: XML GENERATE TAGS

PostPosted: Mon Apr 08, 2013 12:13 pm
by BillyBoyo
Your topic will be moved to the Cobol part of the forum once you reply.

Why do you want to do that? Can something which "understands" XML still read a file like that?

Re: XML GENERATE TAGS

PostPosted: Mon Apr 08, 2013 1:53 pm
by luckyboyroh
Sorry fir posting in wrong section. Pls move .

i guess it will understand. Even i am not sure abt that.

Re: XML GENERATE TAGS

PostPosted: Mon Apr 08, 2013 2:52 pm
by BillyBoyo
Well, "guessing" isn't much use with computers. If you "guess" you can waste a lot of effort only to discover that what you have achieved is pointless.

Paste your example into something which can "understand" XML and see if you get what you expect.

Re: XML GENERATE TAGS

PostPosted: Mon Apr 08, 2013 7:00 pm
by Ed Goodman
Part of the XML GENERATE statement is the 'WITH ATTRIBUTES' parm. It MIGHT do what you need. You would certainly need to change the copybook though.

One link I found showed a work-around that used a table with one occurrence along with 'WITH ATTRIBUTE' to get the desired results.