The XMLATTR and XMLOMIT attributes specify the use of XML attributes and the omission of null values in the XML that is generated by using the XMLCHAR built-in function.
The XMLATTR attribute indicates that the field is presented as an attribute of its containing structure in the XML output that is generated by XMLCHAR.
XMLATTR is invalid with any of the following elements:
The XMLOMIT attribute indicates that the field must be omitted from the XML output that is generated by XMLCHAR if the field is either of the following data items:
XMLOMIT is invalid with any of the following elements:
The following code shows a declaration of a structure with the XMLATTR and XMLOMIT attributes and also the output you get by using XMLCHAR with that structure:
dcl
1 order
2 orderNr char(20) init('1729'),
2 customer,
3 id xmlattr fixed bin(31) init(2917),
3 name xmlattr char(32) init('jakob'),
3 firstname xmlattr char(24) init('michael'),
3 partno fixed bin(31) init(1367),
3 special xmlomit char(35) init('');
<order>
<orderNr>1729</orderNr>
<customer id=2917 name='jakob' firstname='michael'>
<partno>1367</partno>
</customer>
</order>