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

I'm trying to take new ADB and CAS records from the adb and cas tables and write them to a file so that these files get FTPed to the appropriate location,

But it gives me this error message / FTP error.CAS file ". &cas_GetFilename. "not FTPed: Please any suggestion as to fixing this error will be greatly appreciated. See script below!

#Revisions: # # use strict; use NET::SMTP; use Net::FTP; use DBI; use Date::Manip; $ENV{'TZ'} = "EDT"; require "../reformat"; #initialization my $datewritten = UnixDate('today','%m/%d/%Y %H:%M'); my $g_datasource; my (%coninf); &readInfo; my $g_testing=0; if( (scalar @ARGV > 0 and $ARGV[0] eq "test") or not defined $coninf{n +ihits}{dsn} or $coninf{nihits}{dsn} =~ /TEST/i ){ $g_testing=1; } my $today = UnixDate("today","%y%m%d"); open(HI,">>fintrans$today.txt") or &handle_it("Could not open fintrans +$today.txt"); if( $g_testing == 1 ){ print "Testing mode is ON\n"; print HI "Testing mode is ON\n"; } $g_datasource = 'DBI:ODBC:'. $coninf{nihits}{dsn}; my $g_login = $coninf{nihits}{uid}; my $g_pwd = $coninf{nihits}{pwd}; my ($dbh,$sth,$casfile,$adbfile,$records,%ic_conv,$ret); my $g_existingfile = 'casnihit'; #DB connect $dbh = DBI->connect($g_datasource, $g_login, $g_pwd) or &handle_it("Co +uld not connect to the DB"); $dbh->{AutoCommit} = 0; print "Connecting to DSN ", $coninf{nihits}{dsn}, "\n"; print HI "Connecting to DSN ", $coninf{nihits}{dsn}, "\n"; my $fulldate = UnixDate("today", "%m/%d/%Y %H:%M"); print "\nProcess started at $fulldate\n"; print HI "\nProcess started at $fulldate\n"; #if today is a holiday, exit the process my $hol = &is_today_a_holiday; if( $hol ){ print HI "Today is a holiday: $hol\n"; print "Today is a holiday: $hol\n"; exit; } #create the IC convert hash &create_ic_conv; ### process ADB records ### $records = 0; $ret = "\n". &adb_Create; my $error; $error = 0; &do_ftp( 'adb', \$error ) if( not $g_testing and $records > 0 ); print $ret; print HI $ret; if( $error == 1 ){ my $txt = "FTP error. ADB file ". &adb_GetFilename. " not FTPed. T +he ADB records will not be processed.\n"; print $txt; print HI $txt; &send_mail("ADB/CAS FTP Error", $txt); close HI; $dbh->disconnect; exit; } ### process CAS records ### $records = 0; $ret = "\n". &cas_Create; &do_ftp( 'cas', \$error ) if( not $g_testing and $records > 0 ); print $ret; print HI $ret; if( $error == 1 ){ my $txt = "FTP error. CAS file ". &cas_GetFilename. " not FTPed.\n +"; print $txt; print HI $txt; &send_mail("ADB/CAS FTP Error", $txt); close HI; $dbh->disconnect; exit; } ...

Replies are listed 'Best First'.
Re: ADB/CAS FTP Error
by Corion (Patriarch) on Apr 23, 2010 at 17:38 UTC

    Do you really think we will wade through such large and incomplete code? Please show some effort and reduce your program to a small program (say, 20 lines) that still shows the problem.

    My recommendation is to print Net::FTP->message in cases of error, just like the Net::FTP documentation says.

Re: ADB/CAS FTP Error
by ww (Archbishop) on Apr 23, 2010 at 21:02 UTC

    If you remove or comment out line 83, you'll stop getting the error message.

    If you go back and clean up your prior post on this issue, someone may be inclined to look to see if you've changed anything (where the alternatative appears to be that you've simply reposted an ill-formed question with better formatted code).

    And you should probably take Corion's advice first.