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



hi Blake,

I don't see any reason why this code shouldn't work. Can you explain the problems you're having? What errors/symptoms do you get?

Can you please verify that your real code (as opposed to the code in the e-mail) doesn't have the 'ASCEND' or 'DESCEND' keywords on the array? If it /does/ have these keywords, that would explain why it fails. But since you aren't using them in the e-mail post, I don't see why it wouldn't work.

You might want to eliminate the silly hard-coded '26A' since it's superfluous -- but it wouldn't cause the program to not work, it's just silly to hard code something that doesn't need to be hard coded. (RPG can out the length of dsTots automatically.)



BButterworth@xxxxxxxxxxxxxx wrote:

Is it possible? I need to do both a %Lookup on a DS array subfield as well as a SortA. The %lookup works fine on a stand-alone field, but when I put the array inside a DS for the purpose of sorting corresponding elements in other arrays, it doesn't. Based on code form a co-workers program, it appears that the regular LOOKUP op-code will work, but I am using free-format and would like to avoid using fixed-width code for just that operation. Here is the relevant code:
START CODE ----

d ds
d dsTots 26a dim(ARRAY_SIZE)
d depDats 8s 0 overlay(dsTots) inz
d apmTots 9s 2 overlay(dsTots: *next) inz
d cllTots 9s 2 overlay(dsTots: *next) inz

d i s 2s 0
d j s 2s 0

...

// Total deposit amounts for totals file and report.
j = %lookup(wrkDat: depDats);
if j = 0;
i += 1;
depDats(i) = wrkDat;
j = i;
endif;

if cllNbr < APM_START;
cllTots(j) += depAmt;
else;
apmTots(j) += depAmt;
endif;

...

sorta depDats;

------ END CODE

Sorry if I am making some obvious error here or this is a frequently asked question. (I've done some searching online.) I've run it in debug, however, and don't see where I am making a mistake. Any advice or alternate solution would be appreciated and thanks for your assistance.

Blake


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.