DATA Step, Macro, Functions and more

Sysfilrc returns 0 when we try filname FTP with a wrong password

Reply
Occasional Contributor
Posts: 19

Sysfilrc returns 0 when we try filname FTP with a wrong password

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)?
Frequent Contributor
Posts: 91

Re: Sysfilrc returns 0 when we try filname FTP with a wrong password

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
Ask a Question
Discussion stats
  • 1 reply
  • 351 views
  • 0 likes
  • 2 in conversation