Executing Java code using X command

Reply
Contributor
Posts: 31

Executing Java code using X command

Hi,

 

I am executing a Java code inside a SAS Process using an X command like below.

 

X "java -jar /opt/sasinside/SASDATA/test/export_java_test/testspring_jar/testspring.jar testmo6 INVENTORY Inventory.csv /opt/sasinside/SASDATA/test/export_java_test/Inventory.csv"

 

Can we store a Log information of the Java code execution inside a SAS log that Parent code generates?

Can we read a Return code send by a Java code in SAS?

 

we need to do a conditional execution based on a value of the return code send by Java code.

 

 

Thanks,

Nikhil

 

 

 

 

Frequent Contributor
Posts: 128

Re: Executing Java code using X command

[ Edited ]

X won't give much control over your java code. Use preferably SYSTASK :

 

http://www.sascommunity.org/wiki/SAS_Filesystem_Toolbox#7._Calling_and_external_utility_using_SYSTAS...

 

https://support.sas.com/documentation/cdl/en/hostwin/67962/HTML/default/viewer.htm#p09xs5cudl2lfin17...

 

https://support.sas.com/documentation/cdl/en/hostunx/67929/HTML/default/p0lzxl2mwndagun1dtxbst9s4jea...

 

Return codes are handled through Systask STATUS option. See also WAITFOR statement.

 

Depending on your JAVA code compatibility (or even your access to the Java code) with SAS Java Object API, you might perhaps also consider calling java inside the SAS Data Step :

 

https://support.sas.com/documentation/cdl/en/lrcon/68089/HTML/default/viewer.htm#n0swy2q7eouj2fn11g1...

 

I haven't much experience with this API, a good test to decide between the two way 1) external launching using SYSTASK or 2) SAS Java Object might be the cost/amount of work required to adapt the java code to be called by SAS Java Obj. More specifically, as far as I know only java primitive data types are mapped to corresponding SAS types ( variables ) thus requiring additional java wrappers classes in order to pass the values of 'complex' java objects to SAS. 

Ask a Question
Discussion stats
  • 1 reply
  • 413 views
  • 0 likes
  • 2 in conversation