XML GENERATE TAGS

Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS
luckyboyroh
Posts: 35
Joined: Wed Jan 16, 2013 4:05 pm
Skillset: COBOL
Referer: Google

XML GENERATE TAGS

Postby luckyboyroh » Mon Apr 08, 2013 11:47 am

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

enrico-sorichetti
Global moderator
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Skillset: tso,rexx,assembler,pl/i,storage,mvs,os/390,z/os,
Referer: www.ibmmainframes.com

Re: XML GENERATE TAGS

Postby enrico-sorichetti » Mon Apr 08, 2013 12:00 pm

pls let me know your suggestions.

start posting to the right forum section COBOL in this case :ugeek:
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort

BillyBoyo
Global moderator
Posts: 3805
Joined: Tue Jan 25, 2011 12:02 am
Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
Referer: Google

Re: XML GENERATE TAGS

Postby BillyBoyo » Mon Apr 08, 2013 12:13 pm

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?

luckyboyroh
Posts: 35
Joined: Wed Jan 16, 2013 4:05 pm
Skillset: COBOL
Referer: Google

Re: XML GENERATE TAGS

Postby luckyboyroh » Mon Apr 08, 2013 1:53 pm

Sorry fir posting in wrong section. Pls move .

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

BillyBoyo
Global moderator
Posts: 3805
Joined: Tue Jan 25, 2011 12:02 am
Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
Referer: Google

Re: XML GENERATE TAGS

Postby BillyBoyo » Mon Apr 08, 2013 2:52 pm

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.

Ed Goodman
Posts: 341
Joined: Thu Feb 24, 2011 12:05 am
Skillset: 30 years on IBM mainframes
Referer: Searched for Frank Yeager

Re: XML GENERATE TAGS

Postby Ed Goodman » Mon Apr 08, 2013 7:00 pm

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.


  • Similar Topics
    Replies
    Views
    Last post