Rocket® Enterprise Developer (formerly a product of Micro Focus or formerly a product of Open Text) documentation, created before Rocket Software acquired certain products from OpenText, may include outdated references to "Micro Focus" or "OpenText", both of which are trademarks of OpenText or its affiliates. Rocket Software is not affiliated with Micro Focus or OpenText and has since rebranded these products as Rocket® products. You may also encounter outdated links in this documentation. If you do, please contact Rocket Support (support@rocketsoftware.com) for assistance.
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.