BookmarkSubscribeRSS Feed
Pramod_R
Calcite | Level 5
Hi,

I've been trying to do some error checking in my codes by using the automatic system variables like %syslibrc for the libname statement and %sysfilrc for the filename statements. But when I check the sysfilrc after a filename FTP statement with a wrong password to the FTP server, the value still remains 0. See the code below:

filename tempone ftp "'%cmpres(aaa.bbb.ccc.dddd)'"
host = 'FTP-SERVER'
user="user_id"
pass="wrong-pass"
recfm = fb
lrecl= 152
debug ;

%put &sysfilrc;

The above code returns 0 for the sysfilrc.


Is there a way where I could capture the error code for this scenario (filename FTP with invalid password)?
1 REPLY 1
advoss
Quartz | Level 8
My experience indicates that the FTP request doesn't really "happen" until you use it, like in a data step. For example:
72 filename tempone ftp "'abc.def.ghi'"
73 host = 'MYHOST'
74 user="XJOE"
75 pass="&password"
76 /*recfm = fb
77 lrecl= 152*/
78 debug ;
79
80 %put &sysfilrc;
0
81 data _null_;
82 infile tempone;
84 put _all_;
85 run;

NOTE: 220-FTPSERVE IBM FTP CS V1R11 at MYHOST.com, 12:31:58 on 2010-11-24.
NOTE: <<< 220-FTPSERVE IBM FTP CS V1R11 at MYHOST.com, 12:31:58 on 2010-11-24.
NOTE: <<< 220 Connection will close if idle for more than 480 minutes.
NOTE: >>> USER XJOE
NOTE: <<< 500-UX-FTPA616 Command rejected by Security Server
NOTE: <<< 500 User Exit denies Userid '' from using Command 'USER'.
ERROR: Invalid username..
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.18 seconds
cpu time 0.01 seconds

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1004 views
  • 0 likes
  • 2 in conversation