I've got a executable file (without source files, only .exe file) which I am trying to run in a .sas file, using a file reference to an unnamed pipe:
%macro process_file(path);
%let filepath = %trim(&path.);
%let filename = %scan(&path., -1, %str(\));
filename flf pipe "&progpath. ""&filepath."" ""&workpath.\&filename..log""";
data hnd_tmp;
length line $1024.;
infile flf; input;
line = left(trim(compbl(_infile_)));
run;
%mend process_file;
This script basically returns a list of processes which are blocking a particular file (filepath) and returns output to the log file (the third argument).
When I run my code in SAS 9.3 it works well and I receive a desired output, but when I use SAS Enterprise Guide 5.1, the script throws an exception:
Unhandled Exception: System.Exception: Could not list processes locking resource. Failed to get size of result.
at ProcessHelpers.FileUtil.WhoIsLocking(String path)
at ConsoleApplication1.Program.start(String[] args)
at ConsoleApplication1.Program.Main(String[] args
I cannot debug the application, so this exception tells me almost nothing.
I am wondering if there are any differences between running programs in SAS BASE and SAS Enterprise Guide in terms of e.g. environmental variables, system options etc. - something that could possibly lead to the program throwing an exception.
I have been looking for a solution in SAS documentation and papers but with no luck so far.
Do you have any ideas? Thanks in advance.
Edited to provide more details, see comments.
The solution has been tested directly on a networked server and the program throws an exception. I can replicate this situation on a RACE Virtual Machine locally and locally on a server as well. All the servers are running on Windows. Hardcoding the commands did not help, still there's an issue. XCMD is turned on. It seems to be a problem with invoking the code not locally.
X <command>;
runs an OS command from SAS. It works like the PIPE Filename you are using. You could run some OS echos to see what is different between the environments. If that is the problem, then you can get your admin to help you fix it. – DomPazz