Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
XML Generate with Attribute & Element

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Log Thangavel

New User


Joined: 19 Jan 2018
Posts: 6
Location: USA

PostPosted: Fri Jan 19, 2018 6:21 pm    Post subject: XML Generate with Attribute & Element
Reply with quote

Hi!

Am trying to use XML Generate to create the below format. But looks like there is no option to change as both attribute & element. Pls advise

<Master>
<Parent>
<Tag1 type=string>value1</Tag1>
</Parent>
<Parent2>Value2<Parent2>
</Master>
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1963
Location: UK

PostPosted: Fri Jan 19, 2018 7:05 pm    Post subject:
Reply with quote

Is what you posted what you got or what you want? Please provide sample input and output. Also use the code tags when presenting that information.
Back to top
View user's profile Send private message
Log Thangavel

New User


Joined: 19 Jan 2018
Posts: 6
Location: USA

PostPosted: Fri Jan 19, 2018 8:18 pm    Post subject: Reply to: XML Generate with Attribute & Element
Reply with quote

Thanks for your response and Apologise for not being clear on my question.

I need to create xml format shown above. My question is

1.how we define the working storage for this structure
2.xml generate call to show both the attribute and value
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8220
Location: Dubuque, Iowa, USA

PostPosted: Fri Jan 19, 2018 8:29 pm    Post subject:
Reply with quote

Quote:
I need to create xml format shown above. My question is

1.how we define the working storage for this structure
2.xml generate call to show both the attribute and value
What have you tried so far? This is a HELP forum, not a WRITE-THE-CODE-FOR-YOU forum so if you have not tried anything yet, how can we help you? If you have written code, let us see the code and the output (and tell us how the output does not match what you expected). Based on what I've done with XML in COBOL, I suspect that what you want to do may not be possible in COBOL.
Back to top
View user's profile Send private message
Log Thangavel

New User


Joined: 19 Jan 2018
Posts: 6
Location: USA

PostPosted: Sat Jan 20, 2018 12:00 am    Post subject:
Reply with quote

Code:
01 Master.
02 Parent            pic x(5) value ‘parent’
03 tag1.
05 tag-type value pic x(6) value ‘string’
02 parent2           pic x(6) value ‘parent2’
05 parent2-value  pic x(6) value ‘string’



XML generate xml-out from master
Code:
Name of parent is ‘parent’
             parent2 is ‘parent2’
Type of tag-type is attribute
            parent2-value is attribute
             parent is content
             Parent2-value is content



I was able to get the below structure

Code:
<master>
<parent type=‘string’>parent
<parent2 type=‘string’>parent2
</master>


But what is missing is the end tag for parent & parent2
Which are </parent> and </parent2>
Coded - for what it was worth (unless the code really IS that badly formed). Please use the code tags as requested so that we can see your actual code structure
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8220
Location: Dubuque, Iowa, USA

PostPosted: Sat Jan 20, 2018 12:43 am    Post subject: Reply to: XML Generate with Attribute & Element
Reply with quote

Which compiler are you using? Because the code you provided generates a number of syntax errors in Enterprise COBOL version 5.1.1. Furthermore, your PICTURE clauses are too small for the defined data for the Parent and parent2 variables.

Since you do not have periods ending the definition of parent or parent2, that is the most likely reason the </parent> and </parent2> were not generated. In COBOL, periods are important in some places (even though they are less important than they used to be). The problem could also be the mismatch between the variable VALUE and the PICTURE clause definition.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Generate public-private key in batch ... vasanthz All Other Mainframe Topics 6 Fri Sep 15, 2017 9:20 am
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Generate Cohort report using SORT Indrajit_57 SYNCSORT 6 Wed Jun 01, 2016 9:41 am
No new posts SE37 while adding element to endevor kalyan.v CA Products 5 Mon Apr 25, 2016 6:05 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us