in reply to Re: Re: Re: Unix - VMS and Net::Telnet
in thread Unix - VMS and Net::Telnet

I fixed the problem by multiplying the number of input files by 60 and using this as my timeout value... The script below now works:
use strict; use Net::Telnet; use Net::FTP; use Time::Local; my $name = 'USER'; my $passwd = 'PASSWORD'; my $host = 'HOST'; my $prompt = '/MACHINENAME\$/'; my($sdate,$edate,$outfile) = @ARGV; $outfile = uc($outfile); #VMS puts files in uppercase my $command = 'some command'; # Assume each file in a specified date range will take 60 # seconds to process. Multiply # this by 60 to get the timeout value. Large, but we don't # have to deal with timeout problems #Work out how many days in specified range: my($sday,$smon,$syear) = split('-',$sdate); my($eday,$emon,$eyear) = split('-',$edate); my $time1 = timelocal(0,0,0,$sday,$smon,$syear); my $time2 = timelocal(59,59,23,$eday,$emon,$eyear); my $difference = $time2 - $time1; my $days = sprintf("%3.0f", $difference / (60*60*24) ); my $timeout = $days * 60; my $telnet = Net::Telnet->new( Prompt => "/$prompt/", Input_Log => 'input.log', Output_Log => 'output.log', Host => $host, Timeout => $timeout ); $telnet->login(Name => $name, Password => $passwd, Prompt => "/$prompt/", ); $telnet->cmd($command); $telnet->print("lo"); $telnet->close; my $ftp = Net::FTP->new("$host", Debug => 1); $ftp->login($name,$passwd); $ftp->get("$outfile.CSV"); $ftp->delete("$outfile.CSV"); $ftp->quit; exit;