FTP from iSeries to PC server

35 pts.
Tags:
AS/400
FTP
iSeries
I've written a script to ftp text file to PC server. Tried on command line, no issue. But put that in CL program, I got the following error message. My INPUT file is as follow
“
USER username userpwd
NAMEFMT 1
ASCII
PROMPT
CD /ftp
LCD /FTP/outbox
PUT datafile.txt
CLOSE
QUIT
“
Log file shows the following error:
“
FTPLOG
Output redirected to a file.
Input read from specified override file.
Connecting to host server at address 101.115.111.123 using port 21.
220 Microsoft FTP Service
Enter login ID (chris):
331 Password required for QUIT.
Windows_NT
Enter an FTP subcommand.
> QUIT
221 Goodbye.
* * * E N D O F R E P O R T * * *
What is the cause of the error? The exact username & password were used when test via command prompt. Thanks.
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 10  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • pdraebel
    "username" userpwd
    as first line in INPUT file.
    Every other FTP command on a seperate line.
    Last line
    QUIT
    7,545 pointsBadges:
    report
  • ChrisLYL
    Hi pdraebel. Did that. Removed USER. Call with just username userpwd but still the same error message.
    Do I need to open connection to server in the INPUT file prior to username userpwd?
    Thanks
    35 pointsBadges:
    report
  • pdraebel
    It looks to me that your "Double Quotes" are causing the issue. From the FTP output log it looks like the FTP Windows server is taking QUIT as yout user name.

    USER "username" userpwd
    NAMEFMT 1
    ASCII
    PROMPT
    CD /ftp
    LCD /FTP/outbox
    PUT datafile.txt
    CLOSE
    QUIT
    
    In a script 'file INPUT I use to link to a Unix FTP server I even leave out the USER as it looks like a command to FTP. Only use "username" userpwd

    I also had some issues in getting the right format, but just try to tweak the INPUT script untill it works. FTP servers have some little subtle differences that one has to sort out.

    Hope this helps.
    7,545 pointsBadges:
    report
  • ChrisLYL
    I did not use quotes in the file. Tried many combinations but still no luck. 
    Now that you mention, I see the error is at the password prompt.
    Is there a specific requirement for password complexity?
    The INPUT file was created using the following.
    CRTPF FILE(LIB/INPUT) RCDLEN(150) OPTION(*NOSRC             *NOLIST)
    The data were created using dfu. Any concern over here?
    35 pointsBadges:
    report
  • Ricky1234
    Try inserting "REIN" (caps without quote) before the username & password.
    140 pointsBadges:
    report
  • Ricky1234
    And also add the OVRSCOPE(*CALLLVL) parameter value to the OVRDBF command.
    140 pointsBadges:
    report
  • pdraebel
    I looked on the net for SCRIPT examples to Windows FTP server.
    Some provided user on a first line, pwd on the next line.
    Your 331 message stating QUIT as user puzzles me.

    Another option you could try is an OPEN statement.

    7,545 pointsBadges:
    report
  • pdraebel
    On i I usually do :
    OVRDBF FILE(INPUT) TOFILE(SCRIPT)
    FTP ftpsever (or IP)

    That should run the commands in SCRIPT
    7,545 pointsBadges:
    report
  • ChrisLYL
    Thanks all.

    All the above still do not work. It looks to me, INPUT file is not initiated but immediately QUIT took over.
    Will start from square one. 
     
    35 pointsBadges:
    report
  • TheRealRaven
    Since this is a Windows FTP server, the NAMEFMT 1 FTP command won't be needed. If the CD and LCD commands are moved up after the user/password line, the name format should switch to format 1 automatically. Also, if this is going to be a single-file transfer, the PROMPT command shouldn't be relevant. PROMPT generally has meaning only with MGET and MPUT commands.

    The Windows FTP service might have any number of problems. In order to minimize possible problems, I'd minimize me FTP commands and stay as close as possible to strict Windows documentation. My starting point would be this script:
    USER username
    PASS userpwd
    CD /ftp
    LCD /FTP/outbox
    ASCII
    PUT datafile.txt
    CLOSE
    QUIT
    See what errors are reported from a script like that.
    36,370 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: