Try the following Data Structure layout to match the incoming XML message with XML-INTO:
D Channels DS Qualified
D Channel LikeDS(Channel_t)
D Channel DS Qualified Dim(999)
D readingsinpulse...
D 5a
D isregister 5a
D isreadingdecoded...
D 5a
D markettype 5a
D
D ChannelID LikeDS(ChannelID_t)
D Readings LikeDS(Readings_t)
D OptionalChannelDatas...
LikeDS(OptionalChannelDatas_t)
D ChannelID_t DS Qualified
D endpointchannelid...
D 10a
D Readings_t DS Qualified
D Reading LikeDS(Reading_t)
D Reading_t DS Qualified
D Value 20a
D ReadingTime 20a
D OptionalChannelDatas_t DS Qualified
D OptionalChannelData...
LikeDS(OptionalChannelData_t)
D OptionalChannelData_t DS Qualified Dim(9)
D Value 20a
D Name 20a
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Smith, Mike
Sent: Tuesday, April 25, 2017 11:25 AM
To: RPG programming on the IBM i / System i (rpg400-l@xxxxxxxxxxxx)
Subject: xml-into help needed
I'm trying to process an XML file. I am struggling trying to get it loaded via XML-INTO.
I can get the first channel element to load but nothing after that.
Any idea what I've got wrong.
Sample from File
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <!----> <!--Itron FCS Generated: 4/21/2017 9:15:49 AM LT--> <!----> <MeterReadingDocument xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<ImportExportParameters CreateResubmitFile="false">
<DataFormat DSTTransitionType="ITRON_Compliant" ReadingTimestampType="Utc" />
</ImportExportParameters>
<Channels>
<Channel ReadingsInPulse="false" IsRegister="true" IsReadingDecoded="false" MarketType="Gas">
<ChannelID EndPointChannelID="32842936:1" />
<Readings>
<Reading Value="0009290249" ReadingTime="2017-03-31T13:44:46" />
</Readings>
<OptionalChannelDatas>
<OptionalChannelData Name="ERTType" Value="2" />
<OptionalChannelData Name="Tamper1" Value="0" />
<OptionalChannelData Name="Tamper2" Value="2" />
</OptionalChannelDatas>
</Channel>
<Channel ReadingsInPulse="false" IsRegister="true" IsReadingDecoded="false" MarketType="Gas">
<ChannelID EndPointChannelID="41409881:1" />
<Readings>
<Reading Value="0000281274" ReadingTime="2017-04-18T11:51:00" />
</Readings>
<OptionalChannelDatas>
<OptionalChannelData Name="ERTType" Value="12" />
<OptionalChannelData Name="Tamper1" Value="0" />
<OptionalChannelData Name="Tamper2" Value="0" />
</OptionalChannelDatas>
</Channel>
</Channels>
</MeterReadingDocument>
What I currently have for data structures
D Channels DS Qualified Dim(99999)
D Channel LikeDS(Channel)
D ChannelID LikeDS(Channelid)
D Readings LikeDS(Readings)
D Channel DS Template
D readingsinpulse...
D 5a
D isregister 5a
D isreadingdecoded...
D 5a
D markettype 5a
D
D Channelid DS Template
D endpointchannelid...
D 10a
D Readings DS Template
D readingvalue 10a
D readingtime 20a
XML-INTO Channels
%XML(XMLFile: 'doc=file +
datasubf=data +
countprefix=count +
case=any');
NOTICE: This message, including any attachment, is intended as a confidential and privileged communication. If you have received this message in error, or are not the named recipient(s), please immediately notify the sender and delete this message.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
http://amzn.to/2dEadiD
The information contained in this message is confidential and intended only for the use of the individual or entity named above, and may be privileged. Any unauthorized review, use, disclosure, or distribution is prohibited. If you are not the intended recipient, please reply to the sender immediately, stating that you have received the message in error, then please delete this e-mail. Thank you.
As an Amazon Associate we earn from qualifying purchases.