Writing an XML report driver and routine

To produce an XML report, you must start the report with the TO XML HANDLER clause in the START REPORT instruction, and then use the PRINTX statement inside the report routine:

MAIN
  ...
  START REPORT orders_report 
       TO XML HANDLER om.XmlWriter.createFileWriter("orders.xml")
  ...
END MAIN

REPORT order_report(rec)
  ...
  FORMAT
    ON EVERY ROW
      PRINTX NAME = order rec.*
  ...
END REPORT

If all the reports of the program must generate XML output, you can also use the global function fgl_report_set_document_handler().