Re: Sorting EBCDIC



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



Relevant Pages

  • Re: Man hurt using gun to change tyre
    ... conversion hopelessly wrong in each case; ... sane neighbours have a chance of getting the guns off them. ... I suspect that the people in the armed services are by and large 'pro gun' ... people of that sort - except, of course, in the 1960s the army disliked ...
    (uk.people.support.depression)
  • Re: E-Cheques
    ... I would say the conversion ration from questions answered to items bought ... The ones that ask questions prior to purchase also have the highest ... the demographics of buyers for different types of products. ... but I also deal with a great deal of the sort of character ...
    (uk.people.consumers.ebay)
  • Re: Is there a LaTeX FAQ template?
    ... my faq.cls/faq.sty combination works (in a sort of sense) for the ... and the latex->html conversion was done by alan jeffrey). ... you think it is hard to convert the FAQ to a more accessible format? ...
    (comp.text.tex)
  • Re: Christmas label printing
    ... Tree or a Santa which I downloaded years ago from the net, ... Others have made suggestions regarding memory, conversion to JPEG, ... what you are doing is exactly the sort of thing that LaBella ... problem with the RISC OS Postscript 2 driver. ...
    (comp.sys.acorn.misc)