
D customer ds qualified
D id 10a
D value 100a varying
D order ds qualified
D id 10a
D type 10a
D customers ds qualified
D customer likeds(customer) dim(2)
D orderinfo ds qualified
D customer likeds(customer)
D order likeds(order)
<customer id="A34R27K">John Smith</customer>
When XML-INTO encounters "John Smith", it is processing the customer data structure. It finds that the customer data structure has a subfield called value, so it uses that subfield for the "John Smith" data.
xml-into customer %xml('customer1.xml'
: 'doc=file datasubf=value');
// customer.id = "A34R27K"
// customer.value = "John Smith"
<customer id="A34R27K">John Smith</customer>
When XML-INTO encounters "John Smith", it is processing the customer data structure. XML-INTO does not normally support having data for a data structure, so the XML-INTO operation fails with status 00353 due to extra XML data.
xml-into(e) customer %xml('customer2.xml'
: 'doc=file');
// %error = *on
// %status = 353
<customer id="A34R27K">
<value>John Smith</value>
</customer>
The datasubf option is not specified. The XML document has an ordinary XML element called value, so the value subfield of the customer data structure is filled in the usual way. The datasubf option is not needed.
xml-into customer %xml('customer3.xml' : 'doc=file');
// customer.id = "A34R27K"
// customer.value = "John Smith"
xml-into(e) customer %xml('customer3.xml'
: 'doc=file datasubf=value');
// %error = *on
// %status = 353
<orderinfo>
<customer id="A34R27K">John Smith</customer>
<order id="P8H41"><type>telephone</type></order>
</orderinfo>
xml-into orderinfo %xml('customer4.xml'
: 'doc=file datasubf=value');
// orderinfo.customer.id = "A34R27K"
// orderinfo.customer.value = "John Smith"
// orderinfo.order.id = "P8H41"
// orderinfo.order.type = "telephone"
