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



I'm confused. Are you saying that you're going to use %lookup(*blanks) instead of just adding 1 to a number?

i.e. you have a choice between this (as you suggested)

nextElement = %Lookup(*blanks : gs1Attribute);
gs1Attribute(nextElement) = xmlElement;

and this:

nextElement = nextElement + 1;
gs1Attribute(nextElement) = xmlElement;

So I find myself wondering why you'd ever use %lookup? Why search the array when you can simply add 1 to a number? Not only is adding more obvious to the person reading the code, it's also much more efficient for the computer.

You make a big deal about the fact that you're running HTTPAPI's XML parser, but as far as I can tell, that's completely irrelevant to your question. Whether the input is coming from an XML parser or a database file, or data entered by a user, or whatever... it really doesn't matter. The point is that for every new piece of data you receive, you want to advance to the next array element... a common scenario that happens all the time in programming.

Or, perhaps I didn't understand the question...


On 10/13/2010 2:57 PM, Robert Rogerson wrote:
Hi All,

I am using Scott's HTTPAPI program to consume a web service. I consume the
web service with
rc = http_url_post_xml(
urlEndPoint
: %addr(SOAP) + 2
: %len(SOAP)
: *NULL
: %paddr(Incoming)
: *NULL
: HTTP_TIMEOUT
: HTTP_USERAGENT
: 'text/xml'
: SoapAction);

Procedure Incoming is called for each element of the returned XML document.

I have created an array
d gs1Attribute s 256a varying Dim(600)
which I wish to populate with the (XML) element Incoming is currently
processing.

My question is how is the best way to populate the next element in the array
when Incoming is called.

Before calling http_url_post_xml I Clear gs1Attribute so all elements are
blank,
Then on each call of Incoming I want to add the (XML) element(attribute) to
the next element in the array.

The way in which I thought to do this was

nextElement = %Lookup(*blanks : gs1Attribute);
gs1Attribute(nextElement) = xmlElement;

Can anyone suggest an alternative way of doing this or is this a good
method?

Thanks,

Robert Rogerson


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.