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

Re: How FTPAPI handle error



   Hi Mario,
   I have attached the code for you. Have put some comments so that you
   can easily understand.
   Thanks,
   Musthafa

   On Fri, Jan 22, 2010 at 3:02 PM, Mohamed Musthafa Safarulla
   <[1]mohamedmusthafa.safarulla@xxxxxxxxx> wrote:

     Hi Mario,
     I did something like this with FTPAPI..jut worked like a dream.
     I created an XML and dropped it in remote server. Remote server
     will pick it up whenever it wants and process it returns me an XML
     in another folder. So what i did is created a self sbmitting
     program which runs 24/7 polls for any XMLs in the outbound folder.
     If it is there, take it and delete it.
     I can share the code too, if this is what you are looking for.
     Pretty sleek with FTPAPI.
     Thanks,
     Musthafa

   On Fri, Jan 22, 2010 at 11:27 AM, Mario Martoriello
   <[2]martoriello@xxxxxxxxxxxxxxx> wrote:

     Hello Guys
     It 's the first time I use the FTPAPI. I have to send an order via
   ftp
     and receive the confirm order via ftp too. So I have to put the
   order
     and than get the confirm . My problem raise because I don't know
   when
     the confirm's file is ready i.e. I have to wait until the confirm's
     file is done. Can I do this with ftpapi. I suppose that if a get a
     file that is open by an other program I cannot download it and
   receive
     an error. Can I intercept this error and sleep my program and than
     retry the get operation or someone can tip me another solution?
     thanks in advance
     Ing. Mario Martoriello
     Direzione Tecnica
     Tel. + 39 081-5563661
     Cell. +39 335-6324818
     Fax +39 081-5561077
     e-mail [1][3]martoriello@xxxxxxxxxxxxxxx
     [2][4]www.metasoftware.it
     [cid:B66409480DA2417BBE5DCE249A73110D@TP03] Prima di stampare, pensa
     all'ecologia.
     Le informazioni contenute nella presente pagina e nei relativi
     allegati possono essere riservate e sono destinate esclusivamente al
     suindicato destinatario. La diffusione, la distribuzione e/o la
     copiatura del presente documento, dei suoi allegati o di sue parti
   da
     parte di qualsiasi soggetto diverso dal destinatario è proibita, sia
     ai sensi dell'art. 616 c.p. , che ai sensi del D. Lgs. n. 196/2003.
     Il Titolare dei dati è Metasoftware via A.Vaccaro, 20 - 80100
   Napoli,
     nella persona del legale rappresentante della stessa. I dati,
   ottenuti
     nell'ambito delle normali attività aziendali, saranno trattati anche
     con mezzi informatici e conservati presso la sede di Metasoftware
     conformemente con la normativa vigente.
     Se avete ricevuto questo messaggio per errore, vi preghiamo di
     distruggerlo e di informarci immediatamente inviando una e-mail
   a:[3]
     [5]supportotecnico@xxxxxxxxxxxxxxx
     This message and any attachments (the 'message') is intended solely
     for the addressees and is confidential. If you receive this message
   in
     error, please delete it and immediately notify the sender. Any use
   not
     in accord with its purpose, any dissemination or disclosure, either
     whole or partial, is prohibited, except with formal approval. The
     Internet cannot guarantee the integrity of this message.
   Metasoftware
     shall therefore not be liable for the message, if modified.
     Metasoftware accepts no liability for any damage caused by any error
     or virus transmitted by this email.
   References
     1. mailto:[6]martoriello@xxxxxxxxxxxxxxx
     2. [7]http://www.metasoftware.it/
     3. mailto:[8]supportotecnico@xxxxxxxxxxxxxxx

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

     --
     Thanks,
     Musthafa

   --
   Thanks,
   Musthafa

References

   1. mailto:mohamedmusthafa.safarulla@xxxxxxxxx
   2. mailto:martoriello@xxxxxxxxxxxxxxx
   3. mailto:martoriello@xxxxxxxxxxxxxxx
   4. http://www.metasoftware.it/
   5. mailto:supportotecnico@xxxxxxxxxxxxxxx
   6. mailto:martoriello@xxxxxxxxxxxxxxx
   7. http://www.metasoftware.it/
   8. mailto:supportotecnico@xxxxxxxxxxxxxxx
   9. http://www.scottklement.com/mailman/listinfo/ftpapi
H BNDDIR('FTPAPI') DFTACTGRP(*NO) ACTGRP(*NEW)                            
FxxFILES   O    E             DISK                                        
 /COPY libftp/QRPGLESRC,FTPAPI_H                                          
                                                                          
D FileList        S            256A   DIM(100)                          <<=== Get 100 files  
D num_files       S             10I 0                                     
D fileno          S             10I 0                                     
D rc              S             10I 0                                     
D fd              S             10I 0                                     
D ErrNum          S             10I 0                                     
                                                                          
c*                  callp     ftp_logging(0: *Off)                        
                                                                          
 * connect to FTP server.  Log in with user name & password:              
C                   eval      fd =  ftp_conn('ftp.xxxx.net'       <<=== Check login   
C                                   :'userid':'password')             
c                   if        fd < 0                                      
c                   call      'NOTIFY'                                    
c                   eval      *inlr = *on                                 
c                   return                                              
c                   endif                                               
                                                                        
 ** get a list of up to 100 files                                       
c                   callp     ftp_chdir(fd: '/Outbound/')        <<=== Remote folder to get files from             
c                   eval      rc = ftp_list(fd: ' ': 100:               
c                                   %addr(FileList): num_files)         
c                   callp     ftp_quit(fd)                              
                                                                        
                                                                        
c                   if        rc<0                                      
                                                                        
c                   callp     ftp_errorMsg(fd: ErrNum)                  
                                                                        
c                   if        ErrNum = FTP_NOFILE                       
c                   eval      num_files = 0                             
c                   else                                                
c                   call      'NOTIFY'                                  
c                   callp     ftp_quit(fd)                              
c                   eval      *inlr = *on                                       
c                   return                                                      
c                   endif                                                       
                                                                                
c                   endif                                                       
                                                                                
 ** download everything into incoming dir.                                      
c                   Eval      fileno = 1                                        
c                   dow       FileList(fileno) <> *Blanks                       
C                   eval      fd =  ftp_conn('ftp.xxxx.net'        
C                                   :'userid':'password')             
c                   if        fd < 0                                            
c                   call      'EMLMGC'                                          
c                   eval      *inlr = *on                                       
c                   return                                                      
c                   endif                                                       
c                   callp     ftp_chdir(fd: '/Outbound/')                       
 * download each file from the list we produced                                 
c                   if        ftp_get(fd:FileList(fileno):                      
c                             '/tmp/incoming/' +                    <<=== Locatl IFS Folder to receive the files                  
c                             FileList(fileno)) >= *Zero                           
c                   callp     FTP_delete(fd:FileList(fileno))                      
c                   Eval      FilNam = FileList(fileno)                            
c                   Eval      GetDate= %Int(%char(%date():*iso0))                  
c                   Eval      GetTime= %Int(%char(%time():*hms0))                  
c                   Write     ftprec                                <<=== lOG OF ALL THE FILES RECEIVED                                             
c                   endif                                                          
c                   callp     ftp_quit(fd)                                         
c                   Eval      fileno += 1                                          
c                   enddo                                                          
                                                                                   
 ****************************************************************                  
 **  Close FTP session, and end program:                                           
 ****************************************************************                  
c                   callp     ftp_quit(fd)                                         
c                   eval      *inLR = *on                                          
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------