Sorting EBCDIC



Greetings.

I am currently dealing with a dataset that is purely numeric, and some
time next year the data will be migrated to alphanumeric. The data is
structured such that the highest values represent the oldest entity
(reverse sort, essentially). This is signficiant to us when we process
the data in our system because there are times we need to sort the
orders from oldest to newest so we allocate them consistent with how
the source system allocates them.

Here's the rub: the source system is an IBM mainframe that is
assigning the values backwards in EBCDIC. Our system is on an AIX
server.

So, if I'm looking at four orders:
1 2 A B

The mainframe has created them in this order:
2 1 A B

But a descending sort in Perl will put them in this order:
B A 2 1

I looked in the Perl documentation, which basically suggests that I: 1)
get over it (not possible) 2) sort in only one system (not possible) or
3) convert, sort, re-convert. My only option of these is the third.

I'm thinking of something like this:

tr/0-9A-Za-z/a-zA-Z0-9/ for @list_of_orders;
@list_of_orders = sort @list_of_orders;
tr/a-zA-Z0-9/0-9A-Za-z/ for @list_of_orders;

This is conceptual, as the actual code will obviously have a lot more
gunk around it and resides in several programs. Am I on track? Are
there better ways? Has anyone done this before? Am I creating
efficiency problems that I'm not aware of? Is there a module in CPAN
that does this better that has managed to hide from my searches?

I'm not opposed to using a system call to the Unix sort if it has
advantages. Memory will not be an issue.

I am still in the conceptual design phase but am looking for any
feedback. We have several months before we have to do this, but before
I go off and start changing dozens of programs I wanted to see if
anyone had any feedback.

Thanks in advance,
Chris

.



Relevant Pages

  • Re: I got screwed!
    ... The listing ended at 9:27 PM PST. ... limits the bidding to the West Coasters who are still up and sort of leaves ... I pulled up his feedback page and out of 11 pages of feedback, ... something people who will also potentially be using resellers should know. ...
    (sci.med.transcription)
  • RE: Formula Question
    ... Thanks for the feedback. ... This sort ... "Greg Wilson" wrote: ... Commit the formula with Ctrl + Shift + Enter ...
    (microsoft.public.excel.misc)
  • Re: Funny: RIM claimed that touchscreen keyboards were useless...
    ... "just" a little bit (the whole screen is sort of like a big button) and you ... get immediate "real" feedback - you hear an audible clickety sound, ...
    (comp.sys.mac.advocacy)
  • Re: Funny: RIM claimed that touchscreen keyboards were useless...
    ... "just" a little bit (the whole screen is sort of like a big button) and you ... get immediate "real" feedback - you hear an audible clickety sound, ...
    (comp.sys.mac.advocacy)
  • Re: Tuesday A-Z: R
    ... no sound or graphical effect to indicate when a bullet hit you, which is a necessary form of feedback in this sort of game. ...
    (uk.games.video.misc)