DATA Step, Macro, Functions and more

Error using FIlename statement and FTP access method

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 16
Accepted Solution

Error using FIlename statement and FTP access method

Am getting the error "ERROR: Physical file does not exist, /testclear.zip".

 

Code is:-

 

filename rmt ftp '/testclear.zip' host='sftp.ucas.com'
user='anonymous' pass='XXXXX'
cd='/incoming/' recfm=s debug;

 

FILENAME lcl '\\par2\adi\data\STROBE\Jobs\2017\SR170601_001_BRITCO\PROJECT\RAW_DATA\testclear.zip' recfm=n;

 

data _NULL_;
N=1;
INFILE rmt NBYTE=n;
INPUT;
FILE lcl ;
PUT _INFILE_ @@;
run;

 

 

The rest of the log looks ok and file does exist and can be retrieved using FTP portal.  Can anyone help?


Accepted Solutions
Solution
‎07-05-2017 06:48 AM
Super User
Posts: 6,962

Re: Error using FIlename statement and FTP access method

Remove the leading forward slash from the filename:

filename rmt ftp 'testclear.zip' host='sftp.ucas.com'
user='anonymous' pass='XXXXX'
cd='/incoming/' recfm=s debug;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Solution
‎07-05-2017 06:48 AM
Super User
Posts: 6,962

Re: Error using FIlename statement and FTP access method

Remove the leading forward slash from the filename:

filename rmt ftp 'testclear.zip' host='sftp.ucas.com'
user='anonymous' pass='XXXXX'
cd='/incoming/' recfm=s debug;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 16

Re: Error using FIlename statement and FTP access method

[ Edited ]

Ok I've tried that and it still doesn't work.

 

filename rmt ftp '' host='sftp.ucas.com'
user='anonymous' pass='XXXXX'
cd='/incoming/' recfm=s debug;

FILENAME lcl '' recfm=n;

data _NULL_;
N=1;
INFILE rmt NBYTE=n;
INPUT;
FILE lcl ;
PUT _INFILE_ @@;
run;

 

 

Super User
Posts: 6,962

Re: Error using FIlename statement and FTP access method

[ Edited ]

The source file is simply not there. I just did this:

$ ftp sftp.ucas.com
Connected to sftp.ucas.com.
220 UKPASS Secure FTP Server
Name (sftp.ucas.com:XXXXX): anonymous
331 Password required for anonymous.
Password: 
230 Login OK. Proceed.
ftp> cd /incoming/
250 Folder changed to "/incoming".
ftp> ls
200 Command okay.
150 Opening ASCII mode data connection for file list.
jb.txt
226 Transfer complete. 8 bytes transferred. 8 Bps.
ftp> quit

As you can see, there's only one file named jb.txt there.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 105 views
  • 0 likes
  • 2 in conversation