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



Willie,

The reason you're getting a DDE is that some elements of the array (ones you
haven't populated) have blanks in the alot1 subfield.

At V5R3, you can specify %SUBARR with SORTA:

SORTA %SUBARR(alot1 : 1 : X );

assuming X is the highest element you have loaded

Alternatively, you could simply initialize the alot1 subfield with *HIVAL
prior to doing any loads:

eval alot1(*) = *HIVAL;

and then you can use a simple SORTA after all the loads:

SORTA alot1;

Either option should work.

Rory

On Tue, Mar 15, 2011 at 11:38 AM, Willie J. Moore <WJMoore@xxxxxxxxxxxx>wrote:

I have an array with multiple fields. I need to sort the array on one field
(alot1).
Here is my array definition, load and print code.
I have tried using the SORTA on 'a lot', but get a Decimal data error.

D prtfields DS
D allfields 1 320 DIM(10)
D acoat1 3a overlay(allfields:*next)
D awgt 9s 3 overlay(allfields:*next)
D alot1 5s 0 overlay(allfields:*next)
D alot2 5s 0 overlay(allfields:*next)
D abarcod 10s 0 overlay(allfields:*next)

C* Build array.
C*
C add 1 x
C move coat1 acoat1(x)
C move wgt wgt(x)
C move lot1 alot1(x)
C move lot2 alot2(x)
C move barcod abarcod(x)

C* Print report
C X DOUEQ 0
C move abarcod(x) barcod
C move awgt(x) wgt
C move acoat1(x) coat1
C move alot1(x) lot1
C move alot2(x) lot2
C SUB 1 X
C EXCEPT DETAIL
C ENDDO

Any help would be appreciated.

William Moore
California Fine Wire
805-489-5144
wjmoore@xxxxxxxxxxxx

--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.





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.