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