× 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.



Jon,
Yes, I figured my DS were wrong, but I could not see where.

I appreciate the free format DS, but they are not working for me. I am wondering if it is because I am on V7R1.

I've commented out most of it and tried to get just the first part to compile without success.
I get END-DS is missing and END_DS is not expected messages. I was getting them prior to breaking it down to just this one section also.

dcl-ds MeterReadingDocument Qualified;
dcl-ds ImportExportParameters;
CreateResubmitFile char(5);
dcl-ds DataFormat;
DSTTransitionType char(15);
ReadingTimestamp char(5);
end-ds;
end-ds;
end-ds;

mike

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jon Paris
Sent: Tuesday, April 25, 2017 3:54 PM
To: Rpg400 Rpg400-L <rpg400-l@xxxxxxxxxxxx>
Subject: Re: xml-into help needed

I'm going to completely disagree with the others - XML-iNTO is perfect for this and a hell of a lot less work than XML-SAX. But you have to get the DS right.

Your basic problem is, as you no doubt suspected, that your DS are wrong. The DS "shape" has to match the XML. So it looks to me as if your nesting levels are not deep enough. Rather than try and fix yours I just recoded from the XML. I _think_ my version is right - but not tested - if I have time I'll do that because it needs a couple of count fields by the look of it (for OptionalChannelData for example). I see you specified datasubf and countprefix but didn't seem to use either of the, IN fact I don't think datasubf is needed unless you have not shown all of the XML.

It is one of the reasons I love the new free-form data declarations - so much easier. By the way - I suggest that when using templates you clearly identify them as such in their name - I follow IBM's convention and add _T to the name. But with the new nesting support I don't need templates as I can simply code what I need.

dcl-ds MeterReadingDocument Qualified;
dcl-ds ImportExportParameters;
CreateResubmitFile char(n);
dcl-ds DataFormat;
DSTTransitionType char(n);
ReadingTimestamp char(n);
end-ds;
end-ds;

dcl-ds Channels Qualified Dim(nn);
dcl-ds Channel
ReadingsInPulse char(n);
IsRegister char(n);
IsReadingDecoded char(n);
MarketType char(n);
end-ds;
dcl-ds ChannelID;
EndPointChannelID char(n);
end-ds;
dcl-ds Readings << Need a Dim here?
dcl-ds Reading;
Value char(n);
ReadingTime char(n);
end-ds;
end-ds;
OptionalChannelDatas Qualified Dim(nn);
dcl-ds OptionalChannelData
Name char(n);
Value char(n);
end-ds;
end-ds;
end-ds;
end-ds;

Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Apr 25, 2017, at 1:25 PM, Smith, Mike <Mike_Smith@xxxxxxxxxxxxxxxx> wrote:

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

--
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

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.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.