I am new to RPGLE, and I need to create some SQLRPGLE programs whose output is a standard XML file. Below is what I have, more stuff to add, but I want to get good XML output before I try and add all the data in the file. Eventually I will put this code into a host report in the infor IDF in case any of you need to know that. The table it is pulling from is from Infor XA.
The Code
This more or less does what I need it to, but the value for ORDNO is not "P962241". Instead I get the following back.
I think it has something to with the CCSID encoding, but am not sure if that is an SQL option to change that, if it is a PF record format, or the XML output that I need to change.
Any help would be great!
UPDATE:
So it is definitely related to the CCSID of the PF being 37, but I am not sure how to change the CCSID results for the entire query. Is there a compiler option, or something I can have in the d-spec. I can't cast each coulmn value because then the XMLELEMENT starts requiring ")" that are not needed.
The Code
Code:
ctl-opt dftactgrp(*no) actgrp(*caller); //************************************************** ********************** // Files //************************************************** ********************** dcl-s Outfile sqltype(XML_CLOB_FILE); dcl-s Path varchar(100) inz('/home/jarred/PurchaseOrder.xml') ; exec sql set option // Standard SQL Compiler Override Options naming = *sys, // Naming commit = *none, // Commitment Control dynusrprf = *owner, // Dynamic User Profile closqlcsr = *endmod; // Close Cursor clear Outfile ; Outfile_Name = %trimr(Path) ; Outfile_NL = %len(%trimr(Outfile_Name)) ; Outfile_FO = SQFCRT ; //************************************************** ********************** // Write PO Header Information //************************************************** ********************** exec sql VALUES(Select XMLGROUP( ORDNO AS "ORDER_NUMBER", REVNB AS "REVISION") from amflibn.pomast where ORDNO = 'P962241') INTO: Outfile; *inlr = *on ;
Code:
<?xml version="1.0" encoding="UTF-8"?><rowset><row><ORDER_NUMBER>1/n28vL08Q==</ORDER_NUMBER><REVISION>0</REVISION></row></rowset>
Any help would be great!
UPDATE:
So it is definitely related to the CCSID of the PF being 37, but I am not sure how to change the CCSID results for the entire query. Is there a compiler option, or something I can have in the d-spec. I can't cast each coulmn value because then the XMLELEMENT starts requiring ")" that are not needed.
Comment