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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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