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 address07.xml using the XML EXPORT FILE statement.
Next, the syntax of address07.xml is verified using the XML TEST WELLFORMED-FILE statement.
Following this, the content of address07.xml is verified using the XML VALIDATE 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.
For the purposes of this example, both the XML TEST WELLFORMED-FILE and XML VALIDATE FILE statements were used. However, the XML VALIDATE FILE statement also tests an XML document for well-formed syntax.