Best way if there is one to translate a well formed XML document from the DB to a document on the IFS

Tags:
iSeries
XML
We are trying to FTP well formed XML document from DB2 to the IFS.
The data is standard ASN (Advanced Shipping Notice) for our industry (Textile manufacture) ... I've created an MQT so at the appropriate place in our process flow, I plan to REFRESH the MQT ... then use CL if such a command exists to translate to *ASCII and TRIM the CLOB output creating a document on the IFS that will then be picked up and FTPed to our customer (The FTP is easy ... it's getting the CLOB down to just the trimmed XML document that is puzzling me)
CREATE TABLE FABGPL.ASNIMQT
(XMLDATA,
ASNDATE,
CUSTNO,
FBILL) AS (
SELECT   XMLSERIALIZE(XMLELEMENT(NAME "ASNInfo",
xmlrow(    zdwhcode.mdydate(asndat) AS "ASNDate",
asntim AS "ASNTime",     xmlforest (       trim(custno) AS "CustomerNo",
trim(shpnam) AS "ShipToName",       trim(ship1) AS "ShipToAddress1",
trim(ship2) AS "ShipToAddress2",       trim(ship3) AS "ShipToAddress3",
trim(oscity) AS "ShipToCity",       trim(sstate) AS "ShipToState",
trim(szip) AS "ShipToZip"    ) AS "ShipTo",    trim(routcd) AS "ShipingMethod",
trim(rtdesc) AS "ShipingMethodDescription",    trim(fbill) AS "TrackingNumber",
SUM(frtamt) AS "FreightCharges",    SUM(pounds) AS "ShipmentWeight",
XMLAGG(XMLROW(trim(cstprt) AS "CustomerPartNumber",
trim(cuspo) AS "PONumber", trim(invno) AS "InvoiceNumber",
trim(order#) AS "SalesOrderNumber",
ofspec||substr(RANGE+10000,2,4)||'-'||proccd||substr(color+1000,2,3)||'-'||substr(pdye+10000,2,4)||'-'||substr(lamcod+10000,2,4) AS "SKU",
(warpno * 1000)+cutno AS "PieceNumber", trim(fablot) AS "LotNumber", trim(colcod) AS "ShadeCode",
mrkflw AS "MarkedFlaws", grsyds AS "GrossYards",  netyds AS "NetYards", pounds AS "LbsWeight" OPTION row piece)
ORDER BY cstprt, (warpno * 1000)+cutno    )
AS "ShipmentItems" OPTION ROW "BillOfLading"))
AS CLOB(32K) INCLUDING XMLDECLARATION) AS XML_DOCUMENT, zdwhcode.mdydate(asndat), custno, fbill
FROM fabgpl.ediasnpf a
GROUP BY    asndat,
    asntim ,
    custno ,
    shpnam ,
    ship1 ,
    ship2 ,
    ship3 ,
    oscity ,
    sstate ,
    szip ,
    routcd ,
    rtdesc,
    fbill
ORDER BY zdwhcode.mdydate(asndat), custno, fbill
) DATA INITIALLY DEFERRED 
REFRESH DEFERRED 
MAINTAINED BY USER 
ENABLE QUERY OPTIMIZATION 
 ;
COMMIT;
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: