This COBOL program illustrates how an XML document is generated from a COBOL data item, and then how the content of an XML document 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-Struct3 (as defined in the copybook, s-struct3.cpy) to an XML document with the filename of address03.xml using the XML EXPORT FILE statement.
Next, the content of the XML document is imported from the file, address03.xml, and placed in the same data structure 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.