Blog Archive

RPGLE FTP - Get, Put, Delete check for successful transmission Part 4

Click here to read this Tutorial from beginning

To check if the FTP was successful we have to look at the  FTP_OUT file.

foutput    uf   e             disk    rename(qclsrc:i_rec)  

d $put_file       s             50                          
d $status         s              1                          
d $exists         s              1 
c                   dou       %eof(output)                    
c                   read      output                          
c                   if        %eof(output)                    
c                   leave                                     
c                   endif              

c                   eval      $put_file = '> put ' + %trim($file_name)          
c                   if        %subst(srcdta:1:25) = $put_file                    
c                   eval      $exists = 'Y'                                      
c                   endif                                                        
c                   if        srcdta =                                           
c                             '226 File transfer completed successfully.'       
c                   eval      $status = 'Y'                                      
c                   endif                                                        
c                   enddo                                                        
c                   eval      *inlr = *on                                        
c                   return