| 
 | 
I used what Alan Shore replied with except i used overlay (field:*Next) instead of specifying the starting pos
I thought you were using an array of data structures? Didn't you say that, or did I dream it? Must be the latter. SORTA is very easy to use on an "overlay array", as Alan pointed out.
I don't understand why that would yield the results that you posted, though! I tested your claim by running the following code:
     D                 ds
     D myArray                             dim(7)
     D   Field1                       5    overlay(myArray:*NEXT)
     D   Field2                       5s 0 overlay(myArray:*NEXT)
     D   Field3                       5    overlay(myArray:*NEXT)
     D x               s             10I 0
      /free
          Field2(1) = 6;
          Field2(2) = 0;
          Field2(3) = -4;
          Field2(4) = 4;
          Field2(5) = -2;
          Field2(6) = 1;
          Field2(7) = -7;
          sorta Field2;
          for x = 1 to %elem(field2);
               dsply ( %char(x) + ': ' + %char(Field2(x)) );
          endfor;
          *inlr = *on;
      /end-free
When I run this, it gives me -7,-4,-2,0,1,4,6, as you'd expect.  But when 
you posted your results, the negative numbers weren't in the right order. 
So, why does mine work, and yours not?
Maybe a PTF issue?
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.