|
On Mar 4, 2016, at 12:36 PM, tim <iseriesstuff@xxxxxxxxx> wrote:
Thanks Jon, i changed to allowmissing=no.
I didnt include my code since i wasnt even close. After seeing your code, that belief was confirmed. This is my first XML attemp, so mapping whats coming in to DS is a bit tricky. I wish there was a utiltiy our there that would create the DS templates based on the schema.
Another question if i may. I've been testing this process using a string variable. When i try to use a file located in the ifs, i get a "The XML parser detected error code 302".
Here is my code:
xmlfile = '/dandb/00000002_20160302_rsp_OrderProduct.xml';
options = 'path= soapenv:Envelope/+
soap-env:Body/+
fir:OrderProductResponse/+
OrderProductResponseDetail/+
product/+
Organization/+
OrganizationDetail +
case=any +
allowextra=yes +
allowmissing=no +
datasubf=data';
xml-into OrganizationDetail %XML(xmlfile:options);
On 3/4/2016 9:01 AM, Jon Paris wrote:
OK - it would have been nice to have seen that code.
Try to avoid using allowmissing=yes - it allows the entire XML doc to effectively be a completely different document and yet the XML-INTO will succeed. countprefix - as shown in my example - can be used on all V6 and later systems and allows for both missing repeating elements and also for optional elements and attributes. There really is hardly ever a case that needs “allowmissing" these days. See this article (and the others in the series) for more on its use: http://www.itjungle.com/fhg/fhg022316-story03.html
On Mar 3, 2016, at 10:34 PM, tim <iseriesstuff@xxxxxxxxx> wrote:Jon Paris
Thanks jon, i wil give it a try..i have code, but wasnt working.
D testds ds dim(10) qualified
d FamilyTreeMemberRoleText...
D 50
d DNBCodeValue...
D 50
options = 'path= OrganizationDetail/FamilyTreeMemberRole +
case=any allowextra=yes allowmissing=yes';
xml-into testds %XML(xml:options);
On 3/3/2016 10:26 PM, Jon Paris wrote:
Looks pretty straightforward. Something like this.--
dcl-ds OrganizationDetail qualified;
FamilyTreeMemberRole LikeDS(FamilyTreeMemberRole_T) Dim(4); <— See note
StandaloneOrganizationIndicator char(nn);
ControlOwnershipDate char(nn);
ControlOwnershipTypeText LikeDS(ControlOwnershipTypeText_T);
end-ds;
dcl-ds FamilyTreeMemberRole_T qualified;
FamilyTreeMemberRoleText LikeDS FamilyTreeMemberRoleText_T;
end-ds;
dcl-ds FamilyTreeMemberRoleText_T;
DNBCodeValue char(nn);
data char(nn);
end-ds;
dcl-ds ControlOwnershipTypeText_T;
DNBCodeValue char(nn);
data char(nn); <— This is where "Privately owned” goes
end-ds;
XML-INTO will need options datsubf=data if using the names shown in my example.
If there are not always exactly 4 elements of FamilyTreeMemberRole then add count_ FamilyTreeMemberRole with a definition of (say) int(5) to the OrganizationDetail DS and add countprefix=count_ to the options.
Replace nn values with whatever lengths you need.
Note this has NOT been tested but it should be close enough for you to work it out.
P.S. It would have been nice to see you make an effort at coding the DS and _then_ come here for advice on any issues. But then I’ve spent way too much time stuck in traffic jams today so maybe I’m just being crabby.
On Mar 3, 2016, at 9:39 PM, tim <iseriesstuff@xxxxxxxxx> wrote:Jon Paris
Im working on xml files for the first time. I have the following xml snippet and need help with the syntax to read the info into our db.
Any help would be apprecited.
<OrganizationDetail>
<FamilyTreeMemberRole>
<FamilyTreeMemberRoleText DNBCodeValue="12775">Global Ultimate</FamilyTreeMemberRoleText>
</FamilyTreeMemberRole>
<FamilyTreeMemberRole>
<FamilyTreeMemberRoleText DNBCodeValue="12774">Domestic Ultimate</FamilyTreeMemberRoleText>
</FamilyTreeMemberRole>
<FamilyTreeMemberRole>
<FamilyTreeMemberRoleText DNBCodeValue="12773">Parent</FamilyTreeMemberRoleText>
</FamilyTreeMemberRole>
<FamilyTreeMemberRole>
<FamilyTreeMemberRoleText DNBCodeValue="12771">Headquarters</FamilyTreeMemberRoleText>
</FamilyTreeMemberRole>
<StandaloneOrganizationIndicator>false</StandaloneOrganizationIndicator>
<ControlOwnershipDate>1985</ControlOwnershipDate>
<ControlOwnershipTypeText DNBCodeValue="9058">Privately owned</ControlOwnershipTypeText>
</OrganizationDetail>
--
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.
www.partner400.com
www.SystemiDeveloper.com
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.
www.partner400.com
www.SystemiDeveloper.com
--
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.
As an Amazon Associate we earn from qualifying purchases.
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.