LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 19 Jan 2006 16:03:24 -0500
Reply-To:     Michael Raithel <michaelraithel@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Michael Raithel <michaelraithel@WESTAT.COM>
Subject:      Re: How to delete a remote txt file after reading it and using it.
Content-Type: text/plain; charset="US-ASCII"

Dear SAS-L-ers,

Kassa posted the following interesting question:

> Hi Friends; > > I have a SAS Utility which runs on UNIX. This SAS program > reads a text file from remote server called Atlanta2. > > FileName lan ftp 'hdmicnew.txt' debug cd = > 'KASSA\Other_CMI_Mic' host='Atlanta2' user='Bellew' pass='Bellew' ; > > > data Kassa; > infile lan lrecl=247 MISSOVER pad recfm=F; > input > ..... > ......... > Run; > > The above skeleton of statement works good. > > The problem which I am having to be able to delete the text > file 'hdmicnew.txt' that I read ' from Atlanta2 server. The > Atlanta2 server is an NT server. I user SAS 8.2. > > Could some one give me a hint on how to delete a text file > from NT server called Atlanta2 while I am running the SAS on > UNIX server. > > Thanks; > Kassa >

Kassa, from the way that you have parsed out your issue, above, I am assuming that you cannot directly address the NT server directory from your Unix server. I am also assuming that you cannot use SAS/Connect software to remote submit a "delete" command to the NT server. So, that leaves you/me/us with the prospect of utilizing the one tool that you presented in your posting to delete the file: FTP.

There is a ftp DELETE command of the form: delete <filename>. You could play around with attempting to execute it in a SAS FILENAME command after you are done processing your .TXT file. That could look something like this:

FileName lan ftp 'hdmicnew.txt' debug cd = 'KASSA\Other_CMI_Mic' host='Atlanta2' user='Bellew' pass='Bellew' ;

data Kassa; infile lan lrecl=247 MISSOVER pad recfm=F; input .. run;

FileName lan ftp 'hdmicnew.txt' debug cd = 'KASSA\Other_CMI_Mic' host='Atlanta2' user='Bellew' pass='Bellew' delete;

The second FILENAME statement attempts to delete the HDMICNEW.TXT file. It may or may not work; I have not tried it.

As an alternative, you could use an X command or a CALL SYSTEM command to execute straight FTP commands on the Unix system that will delete the file. This alternative would not use the SAS FILENAME statement, but raw, unadulterated FTP commands.

If neither of these two methods pan out, write back. I have a very sneaky, scurvy, sideways idea that would be a "court of last resort" way of doing this task. But, I don't want to give you nightmares if I don't have to. Also, I don't want the list to know just how underhanded I can get when the chips are down!

Kassa, best of luck to you in your quest to clean up after yourself on the NT server!

I hope that this suggestion proves helpful now, and in the future!

Of course, all of these opinions and insights are my own, and do not reflect those of my organization or my associates. All SAS code and/or methodologies specified in this posting are for illustrative purposes only and no warranty is stated or implied as to their accuracy or applicability. People deciding to use information in this posting do so at their own risk.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Michael A. Raithel "The man who wrote the book on performance" E-mail: MichaelRaithel@westat.com Author: Tuning SAS Applications in the MVS Environment Author: Tuning SAS Applications in the OS/390 and z/OS Environments, Second Edition http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=58172

Currently Writing: The Complete Guide to SAS Indexes (due February 28, 2006)

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ The height of cleverness is to be able to conceal it. - Francois de La Rouchefoucauld +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


Back to: Top of message | Previous page | Main SAS-L page