PDA

View Full Version : Perl FTP class: how to get the output of the put command


basti2013
08-03-2006, 12:10 AM
I try to send batch files remotly to a z/os system

If I use ftp from command line on unix I am getting this output when using the put command:

ftp> quote site filetype=jes
200 SITE command was accepted
ftp> put LI4212IN
200 Port request OK.
125 Sending Job to JES internal reader FIXrecfm 80
250-IT is known to JES as J0078968
250 Transfer compleed successfully

In my program I am using the FTP class....so I have:

my $ftp = Net::FTP->new($host, Debug => 0, Passive => 0)
or die "can't open an FTP connection to $host";
$ftp->login($user, $password)
or die "can't authenticate with given username and password.\n";
$ftp->ascii();
$ftp->site("filetype=jes");
$ftp->put("LI4212IN", "LI4212IN") or die "can't upload file $! $?";

unfortunately put returns only the remote filename but I need something like the output if I use ftp from command line "250-IT is known to JES as J0078968" because J0078968 is the JOBID (like a PID) that I need to track

Does anybody know how I can do this with perl?

Thanks!!

FishMonger
08-03-2006, 01:27 AM
Set debug to 1 and it will return all lines of the communication.

basti2013
08-03-2006, 08:05 PM
Hi, thanks for your answer.
actually I just found out that you can use $ftp->message(); to get the output of the last issued command...but thanks anyway