Program description for example 11

This COBOL program illustrates how an XML document with some missing intermediate parent names may be converted into COBOL data format and stored in a COBOL data item.

Before any other XML statement may be executed, the XML INITIALIZE statement must be successfully executed. Since it is possible for XML INITIALIZE to fail, the return status must be checked before continuing.

Data is exported from the data item Address-Struct (as defined in the copybook, s-struct.cpy) to an XML document with the filename of address11.xml using the XML EXPORT FILE statement.

Next, the content of the XML document is imported from the file, address11.xml, and placed in the same data item using the XML IMPORT FILE statement.

Additionally, the content of the predefined XML document named x‑address11.xml, which has some missing intermediate parent names, is also imported using the XML IMPORT FILE statement.

Finally, the XML interface is terminated with the XML TERMINATE statement.

If any of the statements terminate unsuccessfully, the XML GET STATUS-TEXT statement is called.