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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert xml to cobol copybook?

Status
Not open for further replies.

MarcLodge

Programmer
Feb 26, 2002
1,886
GB
Hi All,
I am enhancing a legacy CICS Cobol system to access the net, obtaining data. The stage I am at at the moment is that the website I wish to converse with has passed me a large chunk of XML which details something like 500 fields that are in the comm area between the two.

What I need to do in my cobol program is to define the input and output areas as a copybook. Does anybody know of any tools that can read in a lump of XML and output a cobol copybook? I have come across a piece of XML but it doesn't seem to work particularly well and needs quite a bit of handcrafting after the event.

Marc
 
Marc,

Welcome to the world of XML.

This is a nontrivial exercise. Do you have the XML Schema for the document you wish to process? If you find such a tool, it almost certainly will require the Schema in order to define correctly the receiving (sending) fields in COBOL.

If no tool recommendation is forthcoming, I can help out a bit.

Tom Morrison
 
Tom,
No XML Schema that I can see in the XML. XML starts:
<?xml version="1.0" encoding="UTF-8"?>
<INDATA version = "G">
<SCENARIO_NAME>Test_Seller</SCENARIO_NAME>
<INVOICE>
<CALCULATION_DIRECTION>F</CALCULATION_DIRECTION>
<COMPANY_ID>204</COMPANY_ID>
etc.....

My original post should have said that I have a piece of REXX that converts XML to Cobol, but not particularly well.

Marc
 
Marc,

My way of dealing with things XML is to use XSLT. It is relatively easy to write an XSLT stylesheet that, based on the sample XML document, emits a COBOL record description that mimics the structure of that document.

The XML schema gives info regarding the types of content permitted, which would go into the specifics of the picture.

If this is a one-off, perhaps the XSLT route, with you providing the picture clauses, would be good enough to get you past this and on to solving the problem that you really want to solve?

Tom Morrison
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top