Send As SMS

Thursday, January 18, 2007

FTP with some error checking

filename cmds temp;

data _null_;
   file cmds recfm=v;
   infile datalines;
   input;
   put _infile_;
datalines;
verbose
open ftp.excursive.com
user nogood nogood
ascii on
get index.html
quit
;;;;

/* Windows */
filename ftp pipe "type %SYSFUNC(pathname(cmds)) | ftp -i -n";
/* Unix */
*filename ftp pipe "cat %SYSFUNC(pathname(cmds)) | ftp -i -n";

data _null_;
   retain errfound 1.;
   infile ftp end=end;
   input;
   put 'INFO: ' _infile_;
   if _infile_ =: '226 Transfer completed' then 
      errfound = 0;
   if end and errfound then 
      do;
      put 'ER' 'ROR: FTP failed.';
      *abort abend 12;
      end;
   return;
run;

0 Comments:

Post a Comment

<< Home