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

I'm trying to FTP a file in ASCII mode over to a mainframe, which I can accomplish manually from my workstation. The response that I'm not logged in is very strange since the connection is successfully made, and the quit is successfully received. Bug?

Take a look, and please offer any suggestions you can. Not really sure why its sending a STOR when I told it to do a PUT.....

Code:

if (!($sftp = Net::FTP ->new("main.frame.address", Debug => 1))) { print "Can't connect to mainframe: $@\n"; exit(1); } $sftp -> ascii; if (!($sftp -> put<BR>("/some/path/defined/READY","LOGIN.FILE.PATH.RE +ADY"))) { $sftp -> quit; print "Couldn't put ready file onto mainframe:$@\n"; exit(3); } if (!($sftp ->quit)) { print "Failed to logout\n"; exit(4); } Debug Response: Net::FTP: Net::FTP(2.61) Net::FTP: Exporter(5.562) Net::FTP: Net::Cmd(2.20) Net::FTP: IO::Socket::INET(1.25) Net::FTP: IO::Socket(1.26) Net::FTP: IO::Handle(1.21) Net::FTP=GLOB(0x400389e4) 220-FTPD1 IBM FTP CS V2R6 at main.frame.addr +ess, 10:40:44 on 2001-12-05. Net::FTP=GLOB(0x400389e4) 220 Connection will close if idle for more t +han 5 minutes. Net::FTP=GLOB(0x400389e4) TYPE A Net::FTP=GLOB(0x400389e4) 200 Representation type is Ascii NonPrint Net::FTP=GLOB(0x400389e4) PORT 128,210,99,99,999,999 Net::FTP=GLOB(0x400389e4) 200 Port request OK. Net::FTP=GLOB(0x400389e4) STOR LOGIN.FILE.PATH.READY Net::FTP=GLOB(0x400389e4) 530 Not logged in. Net::FTP=GLOB(0x400389e4) QUI Net::FTP=GLOB(0x400389e4) 221 Quit command received. Goodbye. Couldn't put bursar ready file onto mainframe:
jcwren, 2001/12/05: <code>s tags added

Replies are listed 'Best First'.
Re: Net::FTP to MVS problems with put
by gbarr (Monk) on Dec 05, 2001 at 22:03 UTC
    Well it is giving you 530 Not logged in. simply because you have not called the login method with a username and password. If you want to login as anonymous, then don't pass any arguments to the login method, but you must call it.

    $ftp->login

    STOR is the ftp command behind the put method.

      I'm not worthy!! Thanks for the help on such a foolish mistake, oh wise ones. Problem solved.
Re: Net::FTP to MVS problems with put
by traveler (Parson) on Dec 05, 2001 at 22:04 UTC
    You are not logged in because you forgot to call $sftp->login($username, $password);. Also, STOR is the protocol command corresponding to the user command 'put'.

    HTH, --traveler

Re: Net::FTP to MVS problems with put
by kanwisch (Sexton) on Dec 05, 2001 at 21:49 UTC
    Not really an anonymous Monk, I just forgot to login.