in reply to Net::FTP seems to be corrupting my file

boat73:

I've encountered the same thing. At my facility, it appears that the command-line FTP is in ASCII mode, so when I download a file, it automatically converts from EBCDIC to ASCII. IIRC, Net::FTP defaults to binary mode, in which case you'll get an EBCDIC file, which is a bit of a nuisance. 8^)

--roboticus

  • Comment on Re: Net::FTP seems to be corrupting my file

Replies are listed 'Best First'.
Re^2: Net::FTP seems to be corrupting my file
by boat73 (Scribe) on Mar 19, 2007 at 13:49 UTC
    I thought it might be something like that. i tried calling $ftp->ascii, but that didn't seem to fix the problem. Has anyone done ftp using NET:CMD? If so i greatly appreciate some sample code. Thanks in advance.
      boat73:

      You might then try the rhelp and or rstatus commands to get a list of the commands that your FTP server supports and look for clues. On our mainframe, for example:

      ftp> rhelp 214-The server-FTP commands are: 214-ABOR,*ACCT,*ALLO, APPE, CDUP, CWD, DELE, FEAT, HELP, LANG, LIST, +MDTM, MKD 214-MODE, NLST, NOOP, OPTS, PASS, PASV, PORT, PWD, QUIT, REIN, REST, +RETR, RMD 214-RNFR, RNTO, SITE, SIZE, *SMNT, SYST, STAT, STOR, STOU, STRU, TYPE, + USER 214-ADAT, AUTH, CCC, PBSZ, PROT, EPSV, EPRT 214-The commands preceded by '*' are not implemented 214-The data representation type may be ASCII, EBCDIC or IMAGE, or may + be 214-one of the following Double Byte Character Sets: *** SNIP *** 214-For information about a particular command, type 214 HELP SERVER command or QUOTE HELP command
      Looking at the list of commands available, I dig through a few until I find:
      ftp> rhelp type 214-TYPE {representation-type} {format}: the default type is ASCII. 214-The implemented data types are ASCII(TYPE A <N>), EBCDIC (TYPE E < +N>), 214-IMAGE (TYPE I), DBCS (TYPE B <options>), and UNICODE (TYPE U 2 <B +| L>). 214 The local byte size is 8.
      (The output of rstatus is too long and boring to bother including here, but may have usefulclues for you as well.)

      Anyway, if your server implements some particular command, then you can use the quote method of Net::FTP to send a particular command string to the server to get what you want.

      I hope this is of some use to you...

      roboticus