08-18-2011 06:23 AM
Hello, I've got a problem with execution of x statement in SAS DIS.
So, there is a server under Windows with metadata and other computers with SAS DIS on them. I made a job, that essentially runs a command on the server to execute a Visual Basic script. This script should start a process Excel.exe, that writes some data in .xls report. So, I've this code in my job:
x "cscript D:\Reports\vbs\report.vbs";
And here is a problem: this code executes under 30 seconds and without any changes to .xls report. When I simply use same command in console on the server, it works for about ten minutes and .xls report changes. Sadly, I can't (at least don't know how) track, does cscript start Excel.exe or not, when the job is working. As far as a person responsible for this server knows, there isn't any obstacles from firewalls and so on. Can anybody suggest, what's wrong with this code?
08-18-2011 10:30 PM
Your SAS code looks OK, but many things can affect using SAS X commands in a client-server environment.
The first step is to be able to see what the problem is with the script execution. Try piping the results of the script execution to a file, something like this:
options XSYNC; data _NULL_; x "cscript D:\Reports\vbs\report.vbs > D:\Reports\vbs\report_log.txt"; run;
Review the contents of D:\Reports\vbs\report_log.txt after your code executes for clues as to what went wrong.
08-19-2011 02:52 AM
It was a good idea, but still no luck. I've tried this code in my job - no log-file was created. I've tried this code in SAS 9.1 - it opens a console window and writes something about windows script server and copyrights, as if the command about piping log was simply ignored. I've tried this command in the console - it worked and text about server and copyrights was written in the log-file, but there was never any problem with executing VB script this way. I've got a feeling, that SAS itself has some problems with affecting several files through console or something like that. Any more ideas?
08-19-2011 06:13 AM
Is it as simple as the default time for the x command to 'sleep'? The behavior sounds kind of like the x command is closing before the task is completed. I'm just guessing on this one, and I am sure that you have checked it out, but if not, maybe there is a solution.
08-19-2011 06:36 AM
Well, maybe, but I didn't find any mention of such default time of execution for x statement in the manual. Besides, x statement with cscript works a lot longer in SAS 9.1 than in DIS, so this limitation exists only in DIS? It seems unlikely, but I would happily be proven wrong.
08-20-2011 10:31 PM
Make sure that you have permission to run X command on the DIS server.
Try running another program that does a different command.
x "echo hello > %sysfunc(pathname(work))\hello.dat" ;
If that works then try to find out if you have permission to run the cscript command on the server.
08-22-2011 02:26 AM
As I said earlier, I've used x statement in SAS DIS to add .xls report to archive (x "'c:\Program files\WinRar\Rar.exe' a D:\Reports\report.rar D:\Reports\report.xls" and this command worked, so I have the permission to run x command on the server. Administrator insists, that there isn't anything on the server that can prevent me from running cscript command.
08-23-2011 01:03 AM
I doubted that the user of SAS client is different from the user of console.
The user of SAS client is internal account? and the user of console is actually Operation System user,
So maybe the user of SAS client has not this right.
If you could , try to use SAS Administrator account to test your code.
08-26-2011 08:17 AM
Administrator executed my code in SAS 9.1 under my user and everything was right, then he executed the same code under my user in SAS DIS and again no changes in .xls report. In the end it's been decided to use the scheduler to bypass this problem. And now it's all put on hold until everything is approved.. so thanks for help)