Scarborough has asked for the wisdom of the Perl Monks concerning the following question:

I am working on a windows server and have some (I think?) EBCDIC files produced by some COBOL programs. I have looked at various other threads on this site and looked at Convert::EBCDIC on CPAN but I can't seem to convert them to ASCII. This is what I tried
use strict; use Convert::EBCDIC qw(ebcdic2ascii); my $ascii_string; open EBCDIC, "C:\\EDCDICFILE"; $ascii_string = ebcdic2ascii(<EBCDIC>); print $ascii_string; close EBCDIC;

I'm getting output but none of it makes sense. Now I suspect that Convert::EBCDIC is not for windows.

If its any help the file has a format which has lots of numbers unprintable characters and then goes into a sort of ! delimited file.

I really need to get to the bottom of this but my understanding here is at its limit.

UPDATE Since posting the supplier of the file has got back to me and explained that the file is not EBCDIC but record seq. He's changing his output to be line seq. which I can just read in so problem solved.

But no new learning is wasted as they say.

Replies are listed 'Best First'.
Re: EBCDIC conversions
by gellyfish (Monsignor) on Mar 15, 2005 at 13:54 UTC

    You might want to look at perlebcdic which whilst it largely discusses running perl on EBCDIC systems does offer some insight into the encoding issues, also Encode::EBCDIC might be of some help.

    /J\

      Thanks for your advice, as you can see from my update, I was barking up the wrong tree, but I read you rsuggested text and feel I have a little more understanding.