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



The simple answer is that attributes of an element are at the same hierarchal level as children of that element.

Looking at this example though you have another issue to contend with in that you have attributes and data at the same level. Simple example below of a section of the record part of the document should give you the gist of what you need. I’ve done it in free-from ‘cos I haven’t an editor handy to get the columns right!


dcl-ds controlfield_T Template;
tag char(nn);
data char(nn);

dcl-ds datafield_T Template;


dcl-ds record qualified;
leader char(nn);
controlfield likeds(control field_T dim(nn);
count_controlfield int(5);
datafield likeds(datafield_T) dim(nn);
count_datafield int(5);
etc…

XML-INTO will need the options countprefix=count_ datasubf=data.

The counts will tell you how many of the repeating fields are present and the data subfields contain the element data.

Hope this helps.



On Jan 3, 2016, at 1:09 PM, mlazarus <mlazarus@xxxxxxxx> wrote:

Given this XML example, how would this be defined using the XML-INTO opcode. I'm especially interested in how to define the attributes within the tags, which define the context of the data in the tag, such as:

<datafield tag="035" ind1="" ind2="">
or

<subfield code="a">
<subfield code="d">

----------------

<?xml version="1.0" encoding="UTF-8"?>
<collection>
<record>
<leader>cam a2200325Ia 4500</leader>
<controlfield tag="005">20131214065550.0</controlfield>
<controlfield tag="008">101130s1996 enk 000 0 eng u</controlfield>
<controlfield tag="001">990016589460302486</controlfield>
<datafield tag="035" ind1="" ind2="">
<subfield code="a">(Aleph)001658946EMU01</subfield>
</datafield>
<datafield tag="035" ind1="9" ind2="">
<subfield code="a">u3561214</subfield>
</datafield>
<datafield tag="040" ind1="" ind2="">
<subfield code="d">UtOrBLW</subfield>
</datafield>
<datafield tag="090" ind1="" ind2="">
<subfield code="a">ND497.G2</subfield>
<subfield code="b">G38 1996</subfield>
</datafield>
<datafield tag="245" ind1="0" ind2="0">
<subfield code="a">Gainsborough's House review, 1995/96.</subfield>
</datafield>
<datafield tag="264" ind1="" ind2="1">
<subfield code="a">Sudbury, Suffolk :</subfield>
<subfield code="b">Gainsborough's House Society,</subfield>
<subfield code="c">[1996?]</subfield>
</datafield>
<datafield tag="300" ind1="" ind2="">
<subfield code="a">84 pages :</subfield>
<subfield code="b">illustrations ;</subfield>
<subfield code="c">24 cm</subfield>
</datafield>
<datafield tag="336" ind1="" ind2="">
<subfield code="a">text</subfield>
<subfield code="b">txt</subfield>
<subfield code="2">rdacontent</subfield>
</datafield>
<datafield tag="337" ind1="" ind2="">
<subfield code="a">unmediated</subfield>
<subfield code="b">n</subfield>
<subfield code="2">rdamedia</subfield>
</datafield>
<datafield tag="338" ind1="" ind2="">
<subfield code="a">volume</subfield>
<subfield code="b">nc</subfield>
<subfield code="2">rdacarrier</subfield>
</datafield>
<datafield tag="590" ind1="" ind2="">
<subfield code="a">The High Museum of Art's copy is non-circulating, available only for use on-site at the High Museum. Please ask at the Woodruff Library Service Desk to set up an appointment to use this book.</subfield>
</datafield>
<datafield tag="600" ind1="1" ind2="0">
<subfield code="a">Gainsborough, Thomas,</subfield>
<subfield code="d">1727-1788</subfield>
<subfield code="v">Periodicals.</subfield>
</datafield>
<datafield tag="610" ind1="2" ind2="0">
<subfield code="a">Gainsborough's House</subfield>
<subfield code="v">Periodicals.</subfield>
</datafield>
<datafield tag="610" ind1="2" ind2="0">
<subfield code="a">Gainsborough's House Society</subfield>
<subfield code="v">Periodicals.</subfield>
</datafield>
<datafield tag="710" ind1="2" ind2="">
<subfield code="a">Gainsborough's House Society.</subfield>
</datafield>
<datafield tag="910" ind1="" ind2="">
<subfield code="a">RDA ENRICHED</subfield>
</datafield>
<datafield tag="910" ind1="" ind2="">
<subfield code="a">MARS</subfield>
</datafield>
<datafield tag="945" ind1="" ind2="">
<subfield code="a">EMU mm</subfield>
</datafield>
<datafield tag="940" ind1="" ind2="">
<subfield code="a">HIGH</subfield>
</datafield>
<datafield tag="999" ind1="" ind2="">
<subfield code="p">0</subfield>
<subfield code="e">02</subfield>
<subfield code="b">3561214-1001</subfield>
<subfield code="m">UNIVDX</subfield>
<subfield code="o">UNIVDX</subfield>
<subfield code="d">BOOK</subfield>
<subfield code="f">1</subfield>
<subfield code="n">LSC</subfield>
<subfield code="a">2360241920002486</subfield>
<subfield code="l">LSC</subfield>
<subfield code="q">ND497 .G2 G38 1996 HMA WOP</subfield>
</datafield>
</record>

... repeating <record> groups...

</collection>

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


Jon Paris

www.partner400.com
www.SystemiDeveloper.com


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.