Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSD, XML and COBOL?

Status
Not open for further replies.

Crox

Programmer
Apr 3, 2000
892
0
16
NL
Hi,

converting xsd to cobol or vice versa, are there tools?

also converting xml to flat files and vice versa?

or are there some kind of conversion rules to make something myself?

Thanks!
 
I do not know what XSD is but COBOL does have a builtin XML parser - provided you are using Enterprise COBOL - do not know about other versions.


Nic
 
Crox,
I've written a Cobol prog that takes a long string of XML from a website and parses it. This allowed me to identify the XML fields passed and then obtain the values for those xml fields and assign them to corresponding Cobol variables.

I don't think this is what you're after, but let me know if it is of interest. Platform for this was a z/OS mainframe and the Cobol version was a reasonably up to date mainframe one - sorry can't give much more info as not at my desk.

Marc
 
Hi Crox,

This is a particular interest of mine.

I don't know how complex the XML document is that you wish to consume or create. If the document has much complexity at all, it may be preferable to use an XSLT translating stylesheet to handle the complexity, rather than try to create a COBOL record structure that mimics the document described by the XSD.

Obviously, I can be more helpful if I know the compiler you are using, and the operating system platform (which will help me advise on XML tooling).

I have been a regular on the XML forum: forum426.

So more details, please...

Tom Morrison
Micro Focus
 
Hi, thanks for the responses!

Marc, if you like to share your program with us, perhaps you can show it? I am interested in your approach. In my case i want to create xml, but i have an example of the xml file that has to be created so analysing it, can be helpful.

k5tm: it is on the mainframe but i want to do some conversions on the pc to compare things...

Somebody tipped me that there is a free xml notepad to download. I saw the output on his pc, looks nice.

A long time ago, i wrote the dbfcob program to create a working-storage field from a dbase header and makes a sequential file. I would like to have a tool to create sequential files from xml input with a working storage description and the other way around, so a COBOL copybook and a file as input and xml as output...

Thx!

Crox
 
@Crox, AFAIR there are tools that can do that readily available, but I've not seen free ones.

We have a framework/runtime combo that runs Cobol and Java side by side with full context passing, and I always advise our developers to not even consider Cobol for reading/writing xml, but use Java, as it's close to free for implementation, and waaaay easier. (though they sometimes choose to ignore that advise and spend 3 weeks on what could have been done in 2 days :-( )
If you can't use that complement, then you're out of luck I guess.
 
Anyone that consumes even 2 days may very well need to consider a different approach. Take one of the days and learn XSLT, then take an hour using XSLT and the absolutely most simple XML you can imagine to create any XML document you want. On the consumption side, you can use XSLT to convert an XML document to a sequential text file, if that is easier. As with most any job, using the right tools makes a difference.

(Of course, on a PC, I can recommend other things... [wink])

Crox, Notepad++ has a very decent XML add-in. It is free. However, you can purchase Stylus Studio 'for personal use' very inexpensively; highly recommended.

Tom Morrison
Micro Focus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top