Generating XML Schemas from COBOL in RDz
VenitaJumnani 270003TXAW Visits (8676)
I have been asked this question a few times now so that I decided to post it and the answer for everyone to see.
The question is, “Can RDz generate an XML Schema from a COBOL copybook?”
The answer, in general, is resounding “yes, and much more”. There are some limitations however, the main of which is that your COBOL copybook needs to have a top level 01 item. This is required for the RDz components that generate the XML Schemas (and a lot of other things) to work.
The easiest way to generate an XML Schema from a COBOL copybook, if you have just a few copybooks to process, is to use the “Enable Enterprise Web service” action that appears when you invoke an action menu on your COBOL copybooks. This action appears in many views in RDz perspectives. For example, it appears on all local COBOL files in the Enterprise Service Perspective and on the Remote Systems view of the z/OS Projects perspective. Note that it does not appear in the z/OS Projects fiew.
You now may ask, what do Web services have to do with my need to generate XML Schemas from a COBOL copy book? The short answer is, everything. The longer answer is, XML Schemas will be generated as part of the Web service enablement process for your copybook. There are many more details in the RDz on-line information repositories but suffice it so say here that you can turn generation of some of the Web services artifacts on or off . You can generate the XML Schemas in conjunction with some other artifacts that you can discard if you are not interested in them. The rest of this post will show you how. (The process is based on the currently released version of RDz, which is Version 22.214.171.124, plus or minus a fixpack or two)
When you invoke the Enable Enterprise Web service action by right-mouse click (or whatever mouse button is associated with the context menus), you will see the Enterprise Service Tools Wizard launchpad. You can leave all the defaults on this page, except that you need to change the “Conversion type” entry (the last combo box in the wizard) to “Compiled”.
After you press Start, (and assuming that your copybook has a level 01 and is syntactically correct) you will see the Create New Service Interface wizard. The first page of the wizard will let you select the level 01 structure that you want to generate an XML Schema for. By default, if your copybook is in a local project and you started the wizard from the Navigator view (and not from the remote z/OS systems view), all the files will be generated into the root of the project. You can just press the Finish button at this point. The XML Schema files (file extension xsd) will be part of what’s generated.
If you start from the remote z/OS systems, you will need to go through the wizard to specify the location of where you want the XSDs to be generated to.
There are many more options in the wizard that can be tweaked for generating the XML schemas. There are also ways to script processing of more than just a couple of the copybooks so that you don’t have to go through the wizards 500 times if you have 500 copybooks to process. But that’s a topic (or topics) for another post. There is also much more information in the RDz Education Assistant on the web.
Gary Mazo is a Senior Software Engineer with IBM Rational Developer for System z (RDz). Gary joined IBM in 1987, and spent 10 years developing compilers and compiler tools. Lately, Gary has been actively involved in creating service-oriented architecture (SOA) tools for RDz. He holds 6 software patents and enjoys tinkering with all things related to software and hardware.