-1

Am try to call the java application using SAS(WPS). Java application will return some value/outfile. I need to read the same via SAS and comparing the result with existing values.

Reference Link: http://www2.sas.com/proceedings/sugi30/241-30.pdf

Thanks! Bharathi

Bharathiraja S
  • 679
  • 4
  • 12
  • 26

1 Answers1

1

You can call the Java application using an X command or SYSEXEC statement. Easiest method is if outputs an output file and then you import that. If it's direct output you likely want to use a PIPE approach instead. The variable _infile_ will have the output from the OS command, in this case the Java application.

https://blogs.sas.com/content/sgf/2016/03/11/using-a-pipe-to-return-the-output-of-an-operating-system-command-to-sas-software/

filename myfiles pipe "your command to the OS";                                                                                                    

data results;                                                                                                                            
  infile myfiles truncover;                                                                                                             
  input; 
  x = _infile_;                                                                                                                                                                                                                                          
run;
Reeza
  • 20,510
  • 4
  • 21
  • 38
  • I have used an X command to connect Java. X "-Djava.class.path= /BatchJava/lib/apps/helloWorld.jar"; X "Jreoptions =(-Djava.class.path= '/u/@C7633/BatchJava/lib/apps/helloWorld.jar')"; Getting below error: ERROR: Failed to launch command : An internal error occurred invoking the command. Please Note: We are using ZOS. – Bharathiraja S Aug 21 '18 at 15:24
  • Does the command work from the commandline on that server or computer? – Reeza Aug 21 '18 at 20:14