• Subject: Re: Sort Sequence on a LF
  • From: SirZetar@xxxxxxx
  • Date: Tue, 20 Jul 1999 09:15:35 EDT

<< >
 > Question : How can I change this sort sequence to sort :
 >
 > *blanks, a, A,1, 10, 21, 200 ?
 >
  >>

My apologies if this was already mentioned, but, what about using a varying 
alpha field?  That way, a string length of 0 (*blanks) comes before a string 
length of 1 (a, A), which comes before a string length of 2 (10, 21), etc.

If you're on a version of RPG that doesn't directly support varying fields, 
you could either:

1. make the field varying in the file definition and use a DS to map the 
string length after %Trim into an integer/binary field at the beginning of 
the field with the string following...

2. add a numeric field that would contain the length of the string after 
%Trim and change the LF to include the numeric field ahead of the string.

-Pete
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the RPG/400 Discussion Mailing List!  To submit a new         *
* message, send your mail to "RPG400-L@midrange.com".  To unsubscribe   *
* from this list send email to MAJORDOMO@midrange.com and specify       *
* 'unsubscribe RPG400-L' in the body of your message.  Questions should *
* be directed to the list owner / operator: david@midrange.com          *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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].