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

hi

I've a perl script to convert files from linux ASCII to IBM standard EBCDIC, but it doesn't convert a file.
I get following message:
Can't exec "ascci2ebcdic": No such file or directory at conv1.cgi line 30.
No such file or directory at conv1.cgi line 30.

line 30 is:
open TR, "ascci2ebcdic $file |" or die $!; # Or FQ path
#!/usr/bin/perl -w use strict; use warnings; use Net::FTP; use Net::Netrc; use Convert::EBCDIC qw(ascii2ebcdic ebcdic2ascii); my $server = "x.x.x.x"; my $user = "username"; my $password = "pass"; my $destination = "/tmp"; my $file = "/home/file.txt"; my $ftp = Net::FTP->new ($server, Timeout => 9000, Debug => 3); $ftp or die "$server: cannot connect: $@"; $ftp->login ($user,$password) or die "$_: Could not login: " . $ftp->m +essage; $ftp->cwd($destination); # convert to ebcdic & transfer the file open TR, "ascci2ebcdic $file |" or die $!; # Or FQ path $ftp->binary(); $ftp->put(\*TR,$file); $ftp->quit;
kind regards
cc

Replies are listed 'Best First'.
Re: convert ascii2ebcdic and send via ftp
by rinceWind (Monsignor) on Jun 24, 2004 at 14:39 UTC
    Looks like a typo. Line 30 should read:
    open TR, "ascii2ebcdic $file |" or die $!; # Or FQ path

    --
    I'm Not Just Another Perl Hacker

      Just a small addendum to this. It will not pack or zone anything.. its a simple lookup table conversion mechanism (unless I'm mistaken) So if your IBM machine needs packed or zoned data I would look to a different solution.
        hi Gryngos

        which solution you mean ?
        I've corrected the code but still get error:
        Can't exec "ascii2ebcdic": No such file or directory at conv1.cgi line 30.
        No such file or directory at conv1.cgi line 30.

        If this script doesn't work, I don't have any chance to try this solution first.
        I found in the Internet about this module:
        http://search.cpan.org/~cxl/Convert-EBCDIC-0.06/lib/Convert/EBCDIC.pm
        but don't know how it should work in my case.

        greetings
        cc