It might happen that the information that you want to express in XML format already exists in a group item in the DATA DIVISION, but you are unable to use that item directly to generate an XML document because of one or more factors.
For example:
There are various ways that you can deal with such situations. One possible technique is to define a new data item that has the appropriate characteristics, and move the required data to the appropriate fields of this new data item. However, this approach is somewhat laborious and requires careful maintenance to keep the original and new data items synchronized.
An alternative approach that has some advantages is to provide a redefinition of the original group data item, and to generate the XML output from that redefinition. To do so, start from the original set of data descriptions, and make these changes:
The safest way to accomplish these changes is to use another copy of the original declarations accompanied by one or more REPLACE compiler-directing statements. The example that is referenced below shows a way to do so.
You might also find when you generate an XML document that some of the element or attribute names and values contain hyphens. You might want to convert the hyphens in the element and attribute names to underscores without changing the hyphens that are in the element and attribute values. The example that is referenced below shows a way to do so.
Example: converting hyphens in element or attribute names to underscores
related references
Operation of XML GENERATE (Enterprise COBOL Language Reference)