|Date: ||Tue, 8 Jan 2002 17:13:30 -0500|
|Reply-To: ||Talbot Michael Katz <TopKatz@MSN.COM>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||Talbot Michael Katz <TopKatz@MSN.COM>|
|Subject: ||DOS copy command with %sysexec|
My immediate question concerns the use of the copy command in Windows with %
sysexec. I'll start with that, but that's just the surface issue.
If I issue the copy command from a DOS command line as
copy /b /y "file1" + "file2" /b "file1" ;
it will execute fine up to a length of 127 characters for the line (which
imposes a constraint on the lengths of the filenames).
If I issue the corresponding command within SAS :
%sysexec copy /b /y "&uc." + "&up." /b "&uc." ;
it only seems to work up to 122 characters (starting from the copy and
ending with the last quotation mark). At 123 characters it does nothing.
For 124 or more, it issues an error box :
a device attached to the system is not functioning.
The difference between the SAS DOS and native DOS environments is only
mildly annoying. The bigger problem is, with long filenames allowed, and
virtually unlimited length full path names, I could easily exceed 127
characters in that copy command. So, how can I concatenate files with long
pathnames within a SAS program?
I could breathe a bit easier with the length issue if I could switch
directories to where the files are (let's assume the two files are in the
same directory for now) before the copy, but I'm not sure how to get
multiple DOS commands into a single %sysexec (if that's possible; I imagine
it should be, because I can leave the window open and execute commands at
will, depending on my xwait setting).
Why am I doing all this to begin with? It has to do with remote
submission. A typical remote submission job looks like :
filename rlink 'C:\Program Files\SAS Institute\SAS\V8
options remote= <remote-server-name> ;
/* your code here will run on remote server */
Suppose you wish to run an existing program from your hard drive on the
remote server. You can't just put %include(program_name) between the
rsubmit and endrubmit statements, because anything in there is run as if
it's on the remote server. So, you can either copy and paste your program
in between those statements, or create a new program file with the original
program sandwiched between those statements. I wrote a routine to generate
such files automatically and then include them and either save or get rid
of them afterwards. I used the %sysexec copy as described above to create
the "sandwich" file. So, my next question is, does anyone know a slicker
way to run an existing program remotely without having to copy and paste?
-- TMK --