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

Transferring *SAVF leaves file open



   Hi All

   I'm just starting to get to grips with the FTPAPI and trying to
   transfer *SAVF objects to a Windows based FTP server.  If I use the
   FTP client directly either interactively or with the following script
   the file transfers ok:

   userid password
       cd apollo
       bin
       put QGPL/TRANSFER transfer.savf
       quit

   However, if I use the following RPG program to try and do the same
   thing the file stays open and has an "in use" lock on it within
   Windows:

        H
       BndDir('LIBFTP/FTPAPI')




       ******************************************************************
       *********
            **                     D A T A   D E F I N I T I O N
       S

       ******************************************************************
       *********


            D Session         s             10i
       0
            D Msg             s
       52a
            D FTPRtn          s             10i
       0



       ******************************************************************
       *********
            **                           P R O T O T Y P E
       S

       ******************************************************************
       *********


            D/Include
       LIBFTP/QRPGLESRC,FTPAPI_H
            D AUKR121M03
       Pr
            D  iSavf
       10a



       ******************************************************************
       *********
            **                            I N T E R F A C
       E

       ******************************************************************
       *********


            D AUKR121M03
       Pi
            D  iSavf
       10a



       ******************************************************************
       *********
            **                        M A I N L I N E   C O D
       E

       ******************************************************************
       *********
            C* Connect to the FTP
       server...
            C                   Eval      Session = FTP_Conn('uranus' :
       'userid' :
            C
       'password')


            C* Change to the APOLLO directory on the
       server...
            C                   CallP     FTP_ChDir(Session :
       'apollo')


            C* Go to binary
       mode...
            C                   CallP     FTP_BinaryMode(Session :
       *On)


            C* Put the save file on the
       server...
            C                   Eval      FTPRtn =  FTP_Put(Session
       :
            C                               %Trim(iSavf) + '.savf'
       :
            C
       '/QSYS.LIB/QGPL.LIB/TRANSFER.FILE')
            C                   If        FTPRtn <
       0
            C                   Eval      Msg =
       FTP_ErrorMsg(Session)
            C                   Dsply
       Msg
            C
       EndIf


            C* Exit from the FTP
       server...
            C                   CallP
       FTP_Quit(Session)


            C* Exit from the
       program...
            C                   Eval      *InLr      =
       *On
            C
       Return

   When I check the FTP server log I see the following:

   [5] Fri 19Oct07 12:52:03 - (000071) Connected to 192.168.0.101 (Local
       address 192.168.0.1)
       [6] Fri 19Oct07 12:52:03 - (000071) 220 Serv-U FTP Server v6.4 for
       WinSock ready...
       [2] Fri 19Oct07 12:52:03 - (000071) USER userid
       [6] Fri 19Oct07 12:52:03 - (000071) 331 User name okay, need
       password.
       [2] Fri 19Oct07 12:52:03 - (000071) PASS xxxxx
       [5] Fri 19Oct07 12:52:03 - (000071) User FTPBACKUP logged in
       [6] Fri 19Oct07 12:52:03 - (000071) 230 User logged in, proceed.
       [5] Fri 19Oct07 12:52:03 - (000071) IP-Name: S65AA1AB
       [2] Fri 19Oct07 12:52:03 - (000071) CWD apollo
       [6] Fri 19Oct07 12:52:04 - (000071) 250 Directory changed to
       /apollo
       [2] Fri 19Oct07 12:52:04 - (000071) TYPE I
       [6] Fri 19Oct07 12:52:04 - (000071) 200 Type set to I.
       [2] Fri 19Oct07 12:52:04 - (000071) PORT 192,168,0,101,20,154
       [6] Fri 19Oct07 12:52:04 - (000071) 200 PORT Command successful.
       [2] Fri 19Oct07 12:52:04 - (000071) STOR TRANSFER.savf
       [6] Fri 19Oct07 12:52:04 - (000071) 150 Opening BINARY mode data
       connection for TRANSFER.savf.
       [4] Fri 19Oct07 12:52:04 - (000071) Receiving file
       c:\ftp\apollo\transfer.savf

   Has anybody any idea what it is I'm doing wrong?

   Thanks

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