Errors and their meaning for FILENAME FTP access method failures


This SAS KB article helps you troubleshoot errors that you receive when the FILENAME FTP Access Method fails to read or write data to an FTP server. First, add the DEBUG parameter to the FILENAME FTP statement as shown below in order to get detailed information and then execute the code again.

FILENAME <fileref>  FTP  " '<remote-file>' "  HOST=host-name  USER=user-name PASS=password   DEBUG;

The output from the DEBUG parameter shows the FTP conversation between SAS (FTP client) and the remote FTP server:
Any notes beginning with NOTE: >>> are from SAS.
Any notes beginning with NOTE: <<< are from the remote FTP server.
Note: You can find additional information about these messages by searching the internet.

Possible Errors and Their Meaning

Here are some of the errors that you might receive with a description of why you receive them.

Error MessageReason You Receive It
ERROR: Invalid Reply received for the RETR command...
  • This error indicates that the Retrieve / Get of the remote data failed.
  • Look at "Notes" from the DEBUG output to determine why the Retrieve of data failed.
ERROR: Invalid Reply received for the STOR command...
  • This error indicates that the Store / Put of the remote data failed.
  • Look at "Notes" from the DEBUG output to determine why the Store of data failed.
ERROR: Invalid Reply received for the CWD command...
  • Indicates that there is an invalid value for the CD= parameter in the FILENAME FTP statement.
ERROR: Invalid Reply received for the PORT command...
  • Indicates that you probably need to be using PASSIVE mode.
  • See SAS Note 57813, "The FILENAME FTP connection to the remote FTP server stops responding."
ERROR: Invalid reply received from FTP server...
  • Indicates that you are probably not connecting to an FTP server. 
  • See SAS Note 61222, "Differences between the FILENAME Access Methods: FTP, FTP/TLS, and SFTP."
ERROR 23-2: Invalid option name XXXXX
  • Indicates that you have an invalid parameter xxxxx in the FILENAME statement for using the FILENAME FTP access method. 
  • See SAS Note 61222, "Differences between the FILENAME Access Methods: FTP, FTP/TLS, and SFTP."
ERROR: Logon attempt by <userid> rejected by FTP server...
  • Indicates that the credentials provided in the FILENAME FTP statement with the USER= and PASS= parameters are not valid on the remote host.
ERROR: 10061 - WSAECONNREFUSED.
  • Indicates that there is no FTP server running on the HOST= PORT=<default value is 21> when using the FILENAME FTP access method.  
  • Check with your remote host administrator to see whether FTP is available.
  • You might need to use a different value for PORT= or you might need to use the FILENAME SFTP Access Method.
  • See SAS Note 61222, "Differences between the FILENAME Access Methods: FTP, FTP/TLS, and SFTP."

​​   

DEBUG Output Notes

Here are some possible DEBUG output notes that indicate a problem and their meaning:

DEBUG Output NoteReason You Receive It
NOTE: <<< 425 Unable to build data connection: Connection timed out
NOTE: <<< 425 Can't open data connection.
NOTE: <<< 425 Failed to establish connection.
NOTE: <<< 425 No data connection
  • The "425" FTP message indicates that the port chosen to transfer data is blocked. This can be due to a requirement to use PASSIVE mode or due to a firewall blocking all ports so that no ports are available to transfer data.
  • See SAS Note 57813, "The FILENAME FTP connection to the remote FTP server stops responding."
 NOTE: <<< 501 Invalid data set name " 'SASTST.SMF.CPU.DAILY(7)' ". 
Use MVS Dsname conventions.
  • This message is usually seen for z/OS Generation Data Groups (GDG). 
  • You need to enclose the GDG data set name within double and single quotation marks.
NOTE: 220 Login Required. Unauthorized Access Prohibited.
  • This note indicates that the FTP server is secured and that you need to use FTP/TLS to communicate with the FTP server. 
  • See SAS Note 61222, "Differences between the FILENAME Access Methods: FTP, FTP/TLS, and SFTP," and the FILENAME FTP documentation.