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



Thanks Hans. As I thought more about it, I did not use pointers at all. In
my original note, I stated I could create a "sort" column, which would
receive a copy of the data I want sorted and output - and this is exactly
what I did. Along with judicious use of %subarr, I was able to greatly
reduce the codebase and have only one array for operations.

With a sortvalue field, I performed the equivalent of:
sortvalue = topqty; // copy item quantity array to sortvalue.
sorta sortvalue;
ShowTopN(start:end:10); // show top 10 by quantity
sortvalue = topcost; // extended cost
sorta sortvalue;
ShowTopN(start:end:10); // show top 10 by extended cost
...

And this is exactly what I hoped to accomplish. The ShowTopN procedure, and
a graphing routine that runs behind it, only reference the sortvalue()
array.

One question though: can I do a LIKEDS on this structure?

d ds
d toplist 90 dim(1000) descend
d topdept inz like(sqlrow.department)
d overlay(toplist:1)
d topitem inz like(sqlrow.item)
d overlay(toplist:*next)
...

Since the DS does not have a name, how does one reference it for
duplication? I recall giving a name to the DS but it generated a compiler
system error. I apologize but I did not retain the relevant error.

The program is working very well for me. Thanks everyone for feedback and
bouncing ideas!

--Loyd


On Fri, May 1, 2009 at 4:07 PM, Hans Boldt <hans@xxxxxxxxxx> wrote:


Loyd: Why complicate matters by using pointers?

There are two issues:

First, you have two structures with identical layout. You define the
structure layout ONCE. Then, you define two DS arrays using LIKEDS.

Second, you want to have identical code to process the two arrays. That
means you want ONE procedure, where the DS array is passed as a parameter.

Cheers! Hans




As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.