Previous Topic Next topic Print topic


Example 5 Export and import text

This program first writes (or exports) an XML document as a text string from the content of a COBOL data item. Then the program reads (or imports) the same XML document and places the content in the same COBOL data item. Finally, the text string representation of the XML document is copied to a disk file and the memory block that it occupied is released.

This example uses the following XML statements:

  • XML INITIALIZE, which initializes or opens a session with XML Extensions.
  • XML EXPORT TEXT, which constructs an XML document (as a text string) from the content of a COBOL data item.
  • XML IMPORT TEXT, which reads an XML document (from a text string) into a COBOL data item.
  • XML PUT TEXT, which copies an XML document from a text string to a data file.
  • XML FREE TEXT, which releases the memory that was allocated by XML EXPORT TEXT to hold the XML document as a text string.
  • XML TERMINATE, which terminates or closes the session with XML Extensions.
Previous Topic Next topic Print topic