Example: Checking the FTP output file for errors

While running at the scheduled time, FTP creates data in file member FTPLOG. The data in file member FTPLOG corresponds to original statements found in both examples. Check the output (FTPLOG) for errors that might have occurred during the FTP processing.

Here is an example of the output file:

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
Figure 1. FTP output (FTPLOG) after running FTPBATCH program (Part 1 of 5)
                                                                                         
             Connecting to host name LOOPBACK at address 127.0.0.1using port 21.      
      220-QTCP at localhost.                                                          
      220 Connection will close if idle more than 5 minutes.                          
      Enter login ID (gwil):                                                          
                                                                                      
      >>>GWIL ****                                                                    
      331 Enter password.                                                             
      230 GWIL logged on.                                                             
      i5/OS is the remote operating system.  The TCP/IP versionis "V4R2M0".           
      250 Now using naming format "0".                                                
      257 "QGPL" is current library.                                                  
      Enter an FTP subcommand.                                                        
                                                                                      
      > CLOSE                                                                         
      221 QUIT subcommand received.                                                   
      Enter an FTP subcommand.                                                        
                                                                                      
      > OPEN SYSNAMRS                                                                 
      Connecting to host name SYSNAMRS at address 9.4.73.198 usingport 21.            
      220 sysnamrs.sysnam123.ibm.com FTP server (Version 4.9 ThuSep 2 20:35:07 CDT    
          1993) ready.                                                                
      Enter an FTP subcommand.                                                        
                                                                                      
Figure 2. FTP output (FTPLOG) after running FTPBATCH program (Part 2 of 5)
                                                                                
      > USER root ****                                                                
      331 Password required for root.                                                 
      230 User root logged in.                                                        
      UNIX Type: L8 Version: BSD-44                                                   
      Enter an FTP subcommand.                                                        
                                                                                      
      > ASCII                                                                         
      200 Type set to A; form set to N.                                               
      Enter an FTP subcommand.                                                        
                                                                                      
      > SYSCMD DLTF FILE(GERRYLIB/RS6)                                                
      Enter an FTP subcommand.                                                        
                                                                                      
      > GET /Itsotest GERRYLIB/RS6/RS7                                                
      200 PORT command successful.                                                    
      150 Opening data connection for /Itsotest (467 bytes).                          
      226 Transfer complete.                                                          
      467 bytes transferred in 2.845 seconds. Transfer rate 0.167KB/sec.              
      Enter an FTP subcommand.                                                        
                                                                                      
Figure 3. FTP output (FTPLOG) after running FTPBATCH program (Part 3 of 5)
       |                                                                       
      > CLOSE                                                                        
      221 Goodbye.                                                                   
      Enter an FTP subcommand.                                                       
                                                                                     
      > OPEN MVAX                                                                    
      Connecting to host system mvax at address 9.4.6.252 usingport 21.              
      220 FTP Service Ready                                                          
      Enter an FTP subcommand.                                                       
                                                                                     
      > USER TESTER ******                                                           
      331 User name TESTER received, please send password                            
      230 TESTER logged in, directory $DISK1:[TESTER]                                
      Enter an FTP subcommand.                                                       
                                                                                     
      GET SCREEN1.FILE GERRYLIB/VAX.VAX (REPLACE                                     
      200 PORT Command OK.                                                           
      125 ASCII transfer started for $DISK1:[TESTERSCREEN1.FILE;1(266586 bytes)      
      226 File transfer completed ok.                                                
      265037 bytes transferred in 8.635 seconds. Transfer rate30.694 KB/sec.         
      Enter an FTP subcommand.                                                       
                                                                                     
      > CLOSE                                                                        
      221 Goodbye.                                                                   
      Enter an FTP subcommand.                                                       
                                                                                     
      OPEN SYSNAM02                                                                  
      Connecting to host system SYSNAM02 at address 9.4.73.250using port 21.         
      220-QTCP at SYSNAM02.sysnam123.ibm.com.                                        
      220 Connection will close if idle more than 5 minutes.                         
             Enter an FTP subcommand.                                                
                                                                                     
Figure 4. FTP output (FTPLOG) after running FTPBATCH program (Part 4 of 5)
     |                                                                 
      > USER GWIL ****                                                               
      331 Enter password.                                                            
      230 GWIL logged on.                                                            
       i5/OS is the remote operating system.  The TCP/IP version is "V4R2M0".        
      250 Now using naming format "0".                                               
      257 "QGPL" is current library.                                                 
      Enter an FTP subcommand.                                                       
                                                                                     
      > EBCDIC                                                                       
      200 Representation type is EBCDIC nonprint.                                    
      Enter an FTP subcommand.                                                       
                                                                                     
      > PUT GERRYLIB/RS6.RS6 GERRYLIB/RS6.RS6                                        
      200 PORT subcommand request successful.                                        
      150 Sending file to member RS6 in file RS6 in library GERRYLIB.                
      250 File transfer completed successfully.                                      
      467 bytes transferred in 0.148 seconds. Transfer rate 3.146 KB/sec.            
      Enter an FTP subcommand.                                                       
                                                                                     
      > RCMD SNDNETF FILE(GERRYLIB/RS6) TOUSRID((GERRYLIB SYSNAM14))                 
      250 Command SNDNETF FILE(GERRYLIB/RS6) TOUSRID((GWIL SYSNAM14))                
          successful.                                                                
      Enter an FTP subcommand.                                                       
                                                                                     
  
Figure 5. FTP output (FTPLOG) after running FTPBATCH program (Part 5 of 5)
                                                                               
      > CLOSE                                                                        
      221 QUIT subcommand received.                                                  
      Enter an FTP subcommand.                                                       
      > QUIT                                                                         
      (This ends the FTP application)                                                
                                                                                     

You can either check visually or run a program that tests for error reply codes. Three-digit FTP error reply codes start with 4 or 5. Be careful to avoid messages, such as '467 bytes transferred...'.

Sample procedure: A sample REXX procedure and a sample physical file member are shipped as part of the TCP/IP product. File QATMPINC in library QTCP includes the following two members:

  • BATCHFTP that contains REXX source code to specify the input and output batch files, and start FTP.
  • BFTPFILE that contains the subcommands and data required for logon and running FTP.