SCOUG-Programming Mailing List Archives
Return to [ 09 |
April |
2005 ]
<< Previous Message <<
>> Next Message >>
Content Type: text/plain
Harry Motin wrote:
>
> Peter,
> Please note the following information from the REXXLIB online help:
Hi Harry, thanks for this info.
I guess I could build a sort key and sort on the key. That's probably
the safest thing to do.
_____
Sort of off topic
=================
Building a sort key is what I do right now when I sort externally. I
just put the sort key plus a delimiter string at the beginning of each
line, sort, and then strip off the sort key.
I use a delimiter rather than just stripping off "n" characters because
the sort keys aren't always the same length, for example if a last name
or a city is part of the sort key.
The delimiter string always starts with a space so that the delimiter
characters won't affect the sort sequence -- otherwise, the records may
end up out-of-sequence (a space is lowest in the sort collating sequence
so it keeps the sort key from affecting the sequence).
Example, using "::" and then " ::" for the delimiter:
key1::data
key12::data
sorts to
key12::data OUT OF SEQUENCE ("2" is less than ":")
key1::data
but
key1 ::data
key12 ::data
sorts to
key1 ::data
key12 ::data
The only thing that can go wrong is if two keys are identical except one
has an extra space on the end. In this case, the sort is not an ordered
sort because the shorter key which should be first will sort so it is
last.
Example:
key1 ::data
key1 ::data THIS KEY HAS ONE TRAILING SPACE
sorts to
key1 ::data OUT OF SEQUENCE
key1 ::data
- Peter
=====================================================
To unsubscribe from this list, send an email message
to "steward@scoug.com". In the body of the message,
put the command "unsubscribe scoug-programming".
For problems, contact the list owner at
"postmaster@scoug.com".
=====================================================
<< Previous Message <<
>> Next Message >>
Return to [ 09 |
April |
2005 ]
The Southern California OS/2 User Group
P.O. Box 26904
Santa Ana, CA 92799-6904, USA
Copyright 2001 the Southern California OS/2 User Group. ALL RIGHTS
RESERVED.
SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group.
OS/2, Workplace Shell, and IBM are registered trademarks of International
Business Machines Corporation.
All other trademarks remain the property of their respective owners.
|