× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



This is my first adventure using the XML-INTO and %HANDLER functions to
receive and parse incoming XML data. Currently I am reading the XML doc
from an IFS file. I am able to parse out and get data in my data
structure "POChanges" when I use XML-INTO only, but I need to be able to
process using the %HANDLER function and when I add %HANDLER I get no data
in my data structure "PO Changes".

There are no parsing errors received using the %HANDLER. I do convert the
XML CCSID to 1208 before running the program. If someone would be able to
take a look and see what error I am making it would be greatly
appreciated. I have included the basic program and the XML example.

Thanks,
MLR


Program:
H AlwNull(*UsrCtl) Option(*NoDebugIO) PgmInfo(*PCML:*Module)
H BndDir('QC2LE')
?
*--------------------------------------------------------------------------------------------*
? ??
*--------------------------------------------------------------------------------------------*
??* Procedures
??
*--------------------------------------------------------------------------------------------*
D ProcessPO PR 10i 0
D POCount 10i 0
D POds likeds(PO) Dim(2) Const
D elements 10i 0 Value

??
*--------------------------------------------------------------------------------------------*
??* Data Structures
??
*--------------------------------------------------------------------------------------------*
??*Data Structures to Parse XML Data
D POChanges DS Qualified
D PO LikeDs(PO) dim(2)

D PO DS Qualified
D PONum 8a
D Vendor 8a
D ChangePODetail Likeds(ChangePODetail)
D Dim(45)
D SplitPODetail Likeds(SplitPODetail)
D Dim(45)

D ChangePODetail ds Qualified
D OrigPODetail Likeds(PoDetailType)
D ModPODetail Likeds(PoDetailType)

D SplitPODetail ds Qualified
D OrigPODetail Likeds(PoDetailType)
D ModPODetail Likeds(PoDetailType)
D NewPODetail Likeds(PoDetailType)

D PoDetailType ds
D LineNumber 6
D ItemNumber 25
D Maker 6
D Price 15
D Qty 15
D ShipDate 6
D Mode 3
D FOB 3
D SlsCnfNum 15
D SlsCnfDate 6
D CasePack 9
D AirFrtFlg 1
D AirFrtRsp 10
DAssistChargeReq 1
D AsstCharge 15

??
*--------------------------------------------------------------------------------------------*
??* Stand Alone Fields
??
*--------------------------------------------------------------------------------------------*
D xmlfile s 5000a varying
D PCount s 10i 0
D POCount s 10i 0
D elements s 10i 0
??
*--------------------------------------------------------------------------------------------*
??* M A I N L I N E *
??
*--------------------------------------------------------------------------------------------*

/FREE

xmlfile = '/myfile/POUpdateExample_1.xml';

XML-INTO %HANDLER(ProcessPO : PCount)
%XML(xmlfile : 'path=POChanges case=any +
allowmissing=yes allowextra=yes +
doc=file');


//XML-INTO POChanges %XML(xmlfile : 'path=POChanges case=any +
// allowmissing=yes allowextra=yes
+
// doc=file');
*inlr = *on;
Return;
/END-FREE

?* Handler Routine
p ProcessPO b
D PI 10i 0
D POCount 10i 0
D POds likeds(PO) dim(2) Const
D elements 10i 0 value

D i s 10i 0

/FREE
for i to %elem(POds);
//do something;
endfor;
Return 0;
/end-free
p E

XML:

<?xml version="1.0" encoding="UTF-8" ?>
<POChanges xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="xsd/POChanges.xsd">
<PO>
<PONum>1</PONum>
<Vendor>10197</Vendor>
<ChangePODetail>
<OrigPODetail>
<LineNumber>1</LineNumber>
<ItemNumber>200109</ItemNumber>
<Maker>Ningbo</Maker>
<Price>29400</Price>
<Qty>48</Qty>
<shipDate>2012-03-12</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</OrigPODetail>
<ModPODetail>
<LineNumber>1</LineNumber>
<ItemNumber>200109</ItemNumber>
<Price>30000</Price>
<Qty>60</Qty>
<shipDate>2012-03-17</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</ModPODetail>
</ChangePODetail>
<ChangePODetail>
<OrigPODetail>
<LineNumber>3</LineNumber>
<ItemNumber>200110</ItemNumber>
<Price>27800</Price>
<Qty>48</Qty>
<shipDate>2012-03-12</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</OrigPODetail>
<ModPODetail>
<LineNumber>3</LineNumber>
<ItemNumber>200110</ItemNumber>
<Price>30000</Price>
<Qty>60</Qty>
<shipDate>2012-03-17</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</ModPODetail>
</ChangePODetail>
<ChangePODetail>
<OrigPODetail>
<LineNumber>5</LineNumber>
<ItemNumber>200111</ItemNumber>
<Price>20600</Price>
<Qty>48</Qty>
<shipDate>2012-03-12</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</OrigPODetail>
<ModPODetail>
<LineNumber>5</LineNumber>
<ItemNumber>200111</ItemNumber>
<Price>30000</Price>
<Qty>60</Qty>
<shipDate>2012-03-17</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</ModPODetail>
</ChangePODetail>
<ChangePODetail>
<OrigPODetail>
<LineNumber>7</LineNumber>
<ItemNumber>200114</ItemNumber>
<Price>20600</Price>
<Qty>48</Qty>
<shipDate>2012-03-12</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</OrigPODetail>
<ModPODetail>
<LineNumber>7</LineNumber>
<ItemNumber>200114</ItemNumber>
<Price>36500</Price>
<Qty>60</Qty>
<shipDate>2012-03-17</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</ModPODetail>
</ChangePODetail>
<ChangePODetail>
<OrigPODetail>
<LineNumber>9</LineNumber>
<ItemNumber>200094</ItemNumber>
<Price>20600</Price>
<Qty>48</Qty>
<shipDate>2012-03-12</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</OrigPODetail>
<ModPODetail>
<LineNumber>9</LineNumber>
<ItemNumber>200094</ItemNumber>
<Price>36000</Price>
<Qty>60</Qty>
<shipDate>2012-03-17</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</ModPODetail>
</ChangePODetail>
<ChangePODetail>
<OrigPODetail>
<LineNumber>11</LineNumber>
<ItemNumber>200095</ItemNumber>
<Price>20600</Price>
<Qty>48</Qty>
<shipDate>2012-03-12</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</OrigPODetail>
<ModPODetail>
<LineNumber>11</LineNumber>
<ItemNumber>200095</ItemNumber>
<Price>23800</Price>
<Qty>60</Qty>
<shipDate>2012-03-17</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</ModPODetail>
</ChangePODetail>
<ChangePODetail>
<OrigPODetail>
<LineNumber>13</LineNumber>
<ItemNumber>200097</ItemNumber>
<Price>29400</Price>
<Qty>48</Qty>
<shipDate>2012-03-12</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</OrigPODetail>
<ModPODetail>
<LineNumber>13</LineNumber>
<ItemNumber>200097</ItemNumber>
<Price>23800</Price>
<Qty>60</Qty>
<shipDate>2012-03-17</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</ModPODetail>
</ChangePODetail>
<ChangePODetail>
<OrigPODetail>
<LineNumber>15</LineNumber>
<ItemNumber>200099</ItemNumber>
<Price>29400</Price>
<Qty>48</Qty>
<shipDate>2012-03-12</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</OrigPODetail>
<ModPODetail>
<LineNumber>15</LineNumber>
<ItemNumber>200099</ItemNumber>
<Price>27800</Price>
<Qty>60</Qty>
<shipDate>2012-03-17</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</ModPODetail>
</ChangePODetail>
<ChangePODetail>
<OrigPODetail>
<LineNumber>17</LineNumber>
<ItemNumber>200101</ItemNumber>
<Price>29400</Price>
<Qty>48</Qty>
<shipDate>2012-03-12</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</OrigPODetail>
<ModPODetail>
<LineNumber>17</LineNumber>
<ItemNumber>200101</ItemNumber>
<Price>20600</Price>
<Qty>60</Qty>
<shipDate>2012-03-17</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</ModPODetail>
</ChangePODetail>
<ChangePODetail>
<OrigPODetail>
<LineNumber>19</LineNumber>
<ItemNumber>200103</ItemNumber>
<Price>29400</Price>
<Qty>48</Qty>
<shipDate>2012-03-12</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</OrigPODetail>
<ModPODetail>
<LineNumber>19</LineNumber>
<ItemNumber>200103</ItemNumber>
<Price>36500</Price>
<Qty>60</Qty>
<shipDate>2012-03-17</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</ModPODetail>
</ChangePODetail>
<ChangePODetail>
<OrigPODetail>
<LineNumber>21</LineNumber>
<ItemNumber>200086</ItemNumber>
<Price>29400</Price>
<Qty>48</Qty>
<shipDate>2012-03-12</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</OrigPODetail>
<ModPODetail>
<LineNumber>21</LineNumber>
<ItemNumber>200086</ItemNumber>
<Price>36000</Price>
<Qty>60</Qty>
<shipDate>2012-03-17</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</ModPODetail>
</ChangePODetail>
<ChangePODetail>
<OrigPODetail>
<LineNumber>23</LineNumber>
<ItemNumber>200087</ItemNumber>
<Price>29400</Price>
<Qty>48</Qty>
<shipDate>2012-03-12</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</OrigPODetail>
<ModPODetail>
<LineNumber>23</LineNumber>
<ItemNumber>200087</ItemNumber>
<Price>23800</Price>
<Qty>60</Qty>
<shipDate>2012-03-17</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</ModPODetail>
</ChangePODetail>
<ChangePODetail>
<OrigPODetail>
<LineNumber>25</LineNumber>
<ItemNumber>200088</ItemNumber>
<Price>29400</Price>
<Qty>48</Qty>
<shipDate>2012-03-12</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</OrigPODetail>
<ModPODetail>
<LineNumber>25</LineNumber>
<ItemNumber>200088</ItemNumber>
<Price>29400</Price>
<Qty>60</Qty>
<shipDate>2012-03-17</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</ModPODetail>
</ChangePODetail>
<ChangePODetail>
<OrigPODetail>
<LineNumber>27</LineNumber>
<ItemNumber>200089</ItemNumber>
<Price>29400</Price>
<Qty>48</Qty>
<shipDate>2012-03-12</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</OrigPODetail>
<ModPODetail>
<LineNumber>27</LineNumber>
<ItemNumber>200089</ItemNumber>
<Price>27800</Price>
<Qty>60</Qty>
<shipDate>2012-03-17</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</ModPODetail>
</ChangePODetail>
<SplitPODetail>
<OrigPODetail>
<LineNumber>29</LineNumber>
<ItemNumber>200090</ItemNumber>
<Price>20600</Price>
<Qty>48</Qty>
<shipDate>2012-03-17</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</OrigPODetail>
<ModPODetail>
<LineNumber>29</LineNumber>
<ItemNumber>200090</ItemNumber>
<Price>20600</Price>
<Qty>24</Qty>
<shipDate>2012-03-10</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</ModPODetail>
<NewPODetail>
<LineNumber>29</LineNumber>
<ItemNumber>200090</ItemNumber>
<Price>20600</Price>
<Qty>24</Qty>
<shipDate>2012-03-24</shipDate>
<Mode>OCN</Mode>
<FOB>JOL</FOB>
</NewPODetail>
</SplitPODetail>
<CancelPODetail>
<OrigPODetail>
<LineNumber>31</LineNumber>
<ItemNumber>200090</ItemNumber>
</OrigPODetail>
</CancelPODetail>
</PO>
</POChanges>

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.