[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: trouble after upgrading FTPAPI



Sender: Scott Klement <sk@xxxxxxxxxxxxxxxx>


OPEN myintra port
USER as400 as400
USER user@xxxxxxxxxx password
USER serveruser serverpass
APPEND libname/filename.mbrname file.txt
CLOSE

You have to send 3 separate USER statements to login to the server? I haven't seen a setup like that before. Since FTP_login() also checks for the start of session message from the server, you can't really use it except immediately after connecting.


Instead, you'll have to use the FTP_quote() API to manually send the remaining userids and passwords after you've made the initial connection. The following code is untested, but should illustrate the process:

    //----------------------------------------------
    // login to intranet proxy, first
    //----------------------------------------------

    x = FTP_conn('myintra': 'as400': 'as400': port);
    if (x < 0);
       errormsg = FTP_error();
       // display errormsg to user and exit.
    endif;

    //----------------------------------------------
    // now tell the proxy how to connect to the
    // server
    //----------------------------------------------

    rc = FTP_quote(x: 'USER user@xxxxxxxxxx');
    if (rc<>331);
       errormsg = FTP_error();
       FTP_quit(x);
       // display errormsg to user and exit.
    endif;

    rc = FTP_quote(x: 'PASS password');
    if (rc<>230 and rc<>202);
       errormsg = FTP_error();
       FTP_quit(x);
       // display errormsg to user and exit.
    endif;

    //----------------------------------------------
    // finally, tell it the server our userid and
    //  password
    //----------------------------------------------

    rc = FTP_quote(x: 'USER serveruser');
    if (rc<>331);
       errormsg = FTP_error();
       FTP_quit(x);
       // display errormsg to user and exit.
    endif;

    rc = FTP_quote(x: 'PASS serverpass');
    if (rc<>230 and rc<>202);
       errormsg = FTP_error();
       FTP_quit(x);
       // display errormsg to user and exit.
    endif;

    //----------------------------------------------
    // append the file
    //----------------------------------------------

    if FTP_append(x: 'file.txt'
                 : '/QSYS.LIB/libname.LIB/filename.FILE/mbrname.MBR'
                 ) < 0;
       errormsg = FTP_error();
       FTP_quit(x);
       // display errormsg to user and exit.
    endif;

    //----------------------------------------------
    // quit
    //----------------------------------------------
    callp FTP_quit(x);

Hope that helps
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------