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

RE: Problem with ftp_rmtcmd & ftp_quote



Hi Tommy,

> It works on a command line & the user profile has *ALLOBJ authority.
>

Okay, I wrote the following trivial program as a test.

      H DFTACTGRP(*NO) BNDDIR('FTPAPI')
       /copy ftpapi_h
      D qualfile        ds                  qualified
      D   file                        10A   inz('AUDITFFLDS')
      D sd              s             10I 0
      D rmtcmd          s             80A
       /free
              ftp_log(*on);
              sd = ftp_conn('localhost':'klemscot':'mypassword');
              rmtcmd = 'CRTSAVF SENDLIB/' + %trimr(QualFile.file);
              ftp_rmtcmd(sd: rmtcmd);
              ftp_quit(sd);
              *inlr = *on;
       /end-free

Here's what gets logged when I run this program:

    > call crtsav
      3: 220-QTCP at LOOPBACK.
      3: 220 Connection will close if idle more than 5 minutes.
      3: > USER klemscot
      3: 331 Enter password.
      3: > PASS **********
      3: 230 KLEMSCOT logged on.
      3: > RCMD CRTSAVF SENDLIB/AUDITFFLDS
      3: 250 Command CRTSAVF SENDLIB/AUDITFFLDS successful.
      3: > QUIT
      3: 221 QUIT subcommand received.

Obviously, it works for me.

>From what I can gather from your messages, you're getting this:

550-Error occurred on command CRTSAVF SENDLIB/AUDITFFLDS
550 File AUDITFFLDS not created in library SENDLIB.

Unfortunately, I don't know what to tell you about it.  That "550" isn't 
coming from FTPAPI -- it's coming from the FTP server.  FTPAPI is 
retrieving the error message from the server and dutifully making it 
available for you to read.

The FTP server is encountering an error with your command. It doesn't tell 
you why the command fails, only that it failed.  That's not very 
enlightening.

I guess you could try doing something like this:

              rmtcmd = 'CRTSAVF SENDLIB/' + %trimr(QualFile.file);
              if ftp_rmtcmd(sd: rmtcmd) = -1;
                   rmtcmd = 'DSPJOBLOG OUTPUT(*PRINT)';
                   ftp_rmtcmd(sd: rmtcmd);
              endif;

That way, if the CRTSAVF fails, it'll print it's job log.  Then you can 
log on to the server and read the job log in the spool to find out what 
went wrong.

Of course, there's no guarantee that the CRTSAVF and DSPJOBLOG commands 
will execute in the same job, but in my tests they do... it might provide 
a clue.

-- 
Scott Klement  http://www.scottklement.com

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------