|
I have a MODS defined with Occurs(24)
The DS consists of multiple fields, the first 2 are Year (4,0) and Month (2,0)
I load the DS in my program starting with the first entry.
I can have a variable number of entries, so I store the number of entries in a
variable.
After I have loaded all the data, I want to sort it by Year & Month.
I am attempting to use the qsort function as follows:
QSort (%Addr(Account_Recap) : Im : %Size(Account_Recap) :
%PAddr(Compare));
Where Account_Recap is my MODS
IM is the number of entries used
My compare routine is :
P Compare B
D Compare PI 10I 0
D Element1 Const Like(Account_Recap)
D Element2 Const Like(Element1)
D Element1_Ds DS
D Year_1 Like(Save_Year)
D Month_1 Like(Save_Month)
D Element2_DS DS
D Year_2 Like(Save_Year)
D Month_2 Like(Save_Month)
/free
Element1_Ds = Element1;
Element2_Ds = Element2;
Select;
When ((Year_1 * 100) + Month_1) < ((Year_2 * 100) + Month_2);
Return -1;
When ((Year_1 * 100) + Month_1) > ((Year_2 * 100) + Month_2);
Return 1;
Other;
Return 0;
EndSl;
/End-Free
The problem I am having is that the Compare routine is accessing more than just
the number of entries defined in the IM variable.
Is this normal or am I doing something incorrect.
TIA,
Jeff Young
Sr. Programmer Analyst
Dynax Solutions, Inc.
A wholly owned subsidiary of enherent Corp.
IBM -e(logo) server Certified Systems Exper - iSeries Technical Solutions V5R2
IBM Certified Specialist- e(logo) server i5Series Technical Solutions Designer
V5R3
IBM Certified Specialist- e(logo)server i5Series Technical Solutions
Implementer V5R3
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.