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



Greetings from sunny South Carolina.


We are attempting to code some XML in RPG and have a question which appears not to be covered in the MC Press books we have on the subject. How does one account for an incomplete data set and keep everything in its place? Working with name and address information, we must account for a second line of address although a second line will not always be given. Loading blanks doesn't appear to work.


Our example:

<?xml version="1.0" encoding="utf-8"?>

<responses error="false" resultCode="Success" responseMessage="Success">
<response refNum="T:W62L6YS41" requestID="236985478" success="true" error="false" resultCode="Success">
<addressLine1 number="110" street="Elm Court"/>
<addressLine2 attnLine="C/O Jonny Mayes"/>
</response>
<response refNum="T:W62L6YS41" requestID="236985478" success="true" error="false" resultCode="Success">
<addressLine1 number="136" street="Main Street"/>
</response>
<response refNum="T:W62L6YS41" requestID="236985478" success="true" error="false" resultCode="Success">
<addressLine1 number="331" street="John Street"/>
<addressLine2 attnLine="Apt 1c"/>
</response> </responses>


The Code should be set up...

repsonsesds
error
ressultcode
response message
responseds
refNum
requestID
success
error
result
addressLine1ds dim(10) varying
number
street
addressLine2ds dim(10) varying
attnLine



xml-into responsesds ...

xml-into responseds ...

xml-into addressLine1ds ...

xml-into addressLine 2ds ...


These commands will load all attributes of (node) responses into the fileds for responsesds, then load all
attributes of (node) response into the fileds for responseds.

However, addressLine1ds will have the following...

number(1) 110 street(1) Elm Court
number(2) 136 street(2) Main Street
number(3) 331 street(3) John Street

addressLine2ds will have the following...

attnline(1) C/O Jonny Mayes
attnline(2) Apt 1c


Now number and street (ds table entries) are out of sync with attnline (ds table entries). We would want attnline(2) to load as blanks. However, it doesn't and it continues to read until it finds the next attnLine and loads into the next variable.

How do we get the table entries to be in synch?

Thanks,



Robert Munday
Munday Software Consultants
Montgomery, AL
on assignment in Columbia, SC
soon to be somewhere else...



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.