Re: Sorting EBCDIC
- From: Uri Guttman <uri@xxxxxxxxxxxxxxx>
- Date: Fri, 15 Dec 2006 12:48:04 -0500
"CH" == Chris Hamel <hamelcd@xxxxxxxxxxx> writes:
CH> Here's the rub: the source system is an IBM mainframe that is
CH> assigning the values backwards in EBCDIC. Our system is on an AIX
CH> server.
CH> So, if I'm looking at four orders:
CH> 1 2 A B
CH> The mainframe has created them in this order:
CH> 2 1 A B
CH> But a descending sort in Perl will put them in this order:
CH> B A 2 1
CH> I looked in the Perl documentation, which basically suggests that I: 1)
CH> get over it (not possible) 2) sort in only one system (not possible) or
CH> 3) convert, sort, re-convert. My only option of these is the third.
CH> I'm thinking of something like this:
CH> tr/0-9A-Za-z/a-zA-Z0-9/ for @list_of_orders;
CH> @list_of_orders = sort @list_of_orders;
CH> tr/a-zA-Z0-9/0-9A-Za-z/ for @list_of_orders;
use the unix dd utility to do ebcdic/ascii conversion. you ain't gonna
easily get it right with tr///. there might be a cpan module for this
too and should be easy to find by searching for ebcdic
CH> This is conceptual, as the actual code will obviously have a lot
CH> more gunk around it and resides in several programs. Am I on
CH> track? Are there better ways? Has anyone done this before? Am I
CH> creating efficiency problems that I'm not aware of? Is there a
CH> module in CPAN that does this better that has managed to hide from
CH> my searches?
look at Sort::Maker which may save you a lot of work. you can describe
your sort keys and forward/reverse, do conversion one time (it will
return the sorted original data) and you could possibly do the
conversion on the fly if you find a module for it.
CH> I am still in the conceptual design phase but am looking for any
CH> feedback. We have several months before we have to do this, but before
CH> I go off and start changing dozens of programs I wanted to see if
CH> anyone had any feedback.
doesn't sound like too complex a project. first get a proper
specification of your sort keys (including any conversion). then code it
up in sort::maker and you should be done.
uri
--
Uri Guttman ------ uri@xxxxxxxxxxxxxxx -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
.
- Follow-Ups:
- Re: Sorting EBCDIC
- From: Ben Morrow
- Re: Sorting EBCDIC
- References:
- Sorting EBCDIC
- From: Chris Hamel
- Sorting EBCDIC
- Prev by Date: Re: Calculating values of a 2d array by comparison of 2 strings
- Next by Date: Multi-posting (was: Beginner writing...)
- Previous by thread: Sorting EBCDIC
- Next by thread: Re: Sorting EBCDIC
- Index(es):
Relevant Pages
|