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



On 2015-01-27 14:01, James H. H. Lampert wrote:
I have a situation in which I need to sort a character (EBCDIC) array, 5
characters per element, using the ASCII/Unicode collating sequence
rather than the EBCDIC collating sequence.

Does anybody know of an easy way to do this? I'm thinking SORTA, but do
I want to do this by setting up the ASCII collating sequence as an
ALTSEQ (if so, how?), or do I want to do it by sending the array on a
round trip to Unicode, and sorting it as Unicode?


Using ALTSEQ would cause all the character comparisons in the module to use that collating sequence which you probably don't want.

I would assign the char array to a UCS-2 temp array, sort that temp array, and then copy the result back to the char array.

Here's a little example. It displays
DSPLY Ebcdic sort : @@@@@, aaaaa, 11111
DSPLY Ucs-2 sort : 11111, @@@@@, aaaaa

D arr s 5a dim(3)
D ucs2_arr s 5c dim(3)
/free
arr(1) = 'aaaaa';
arr(2) = '11111';
arr(3) = '@@@@@';
sorta arr;
dsply ('Ebcdic sort : ' + arr(1) + ', '
+ arr(2) + ', ' + arr(3));

ucs2_arr = arr;
sorta ucs2_arr;
arr = ucs2_arr;
dsply ('Ucs-2 sort : ' + arr(1) + ', '
+ arr(2) + ', ' + arr(3));
return;


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.