ftp return code

Reply
Occasional Contributor
Posts: 13

ftp return code

Hello,

I´m doing a ftp, and I don´t know how control if there is an error becouse the transfer is not ok

- if the server is down

- is the directory is full

Can you help me? Here the code,

Thanks

filename indir

    ftp '/dir1/dir2/'

    host='host1' DIR

         user='uss01' pass=pass01;

    filename outdir

    ftp '/' host='host2' DIR

   user='uss02' pass=pass02;

    data _null_;

       infile indir(Fich.csv) truncover;

       input;

       file outdir(Fich.csv);

       put _infile_;

    run;

Super User
Posts: 7,382

Re: ftp return code

When using FILENAME FTP, a data step using those filerefs will give you ERROR messages in the log if the files are not accessible.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 13

Re: ftp return code

So, there is not any option to controled it and insert the problem, for example 'FTP not OK' in a control table?

Thanks

Super User
Posts: 7,382

Re: ftp return code

If you run a SAS program containing FTP filerefs in batch mode, and the FTP access fails, the final exit code of the SAS job will be 2, so you can use that in the scheduler to flag the job as failed.

When running interactively, you will notice the fail anyway.

What exactly is your problem that you need to solve?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 3 replies
  • 278 views
  • 0 likes
  • 2 in conversation