If you are using Data Direct Connect ODBC drivers, you must use version 3.70 or later.
01 hv pic x(50). procedure-division. *> set whenever clause to handle sql errors exec sql whenever sqlerror goto sql-error end-exec exec sql whenever sqlwarning perform sql-warning end-exec *> connect to data source exec sql connect to "data source" end-exec *> declare static cursor with column info you want to save to xml file exec sql declare c static cursor for select * from emp end-exec *> open cursor exec sql open c end-exec *> save data to xml file using double quoted literal exec sql persist c to "c:\XML Files\xmltest1.xml" end-exec *> save data to xml file using single quoted literal exec sql persist c to 'c:\XML Files\xmltest2.xml' end-exec *> save data to xml file using a host variable move "c:\XML Files\xmltest3.xml" to hv exec sql persist c to :hv end-exec *> close the cursor exec sql close c end-exec *> disconnect from datasource exec sql disconnect current end-exec goback.