Am try to call the java application using mainframe SAS 9.1 (WPS). Its a simple hello world program in which Java application will return some value/outfile. I need to read the same via SAS and comparing the result with existing values.
But when i try to execute it hits an error :
ERROR: Could not find JREOPTIONS entry for "-Dwps.jre.libjvm="
Since this is a mainframe sas , as posted in other blogs i am not able to set the class path .
On the other hand we are able to access java via JCL through a proc but i need the same via sas .
My code :
/*options jreoptions =(-Djava.class.path= */
/*jreoptions =(-Djava.class.path=
"/u/siva/BatchJava/lib/apps/helloWorld.jar") ; */
proc options option=jreoptions;
run;
/*%INCLUDE 'SYSS.P.COZEEE.PARMLIB(COZCFGD)'; */
proc javainfo; run;
endsas;
%macro init_classpath_update;
DATA _null_;
LENGTH path_separator $ 2
orig_classpath $ 500;
path_separator = '/';
DECLARE JavaObj f("java.io.File", "");
f.getStaticStringField("pathSeparator", path_separator);
orig_classpath = STRIP(SYSGET("CLASSPATH"));
IF _ERROR_ = 1 OR LENGTH(orig_classpath) = 0 THEN DO;
PUT "NOTE: Ignore any messages from the next statement(s)";
orig_classpath = "";
END;
CALL SYMPUTX('CP_orig_classpath',
STRIP(orig_classpath), 'GLOBAL');
CALL SYMPUTX('CP_path_separator',
COMPRESS(path_separator), 'GLOBAL');
RUN;
%mend;
%macro add_to_classpath(cp_addition);
DATA _null_;
LENGTH current_classpath $ 500
new_classpath $ 500;
current_classpath = STRIP(SYSGET("CLASSPATH"));
IF _ERROR_ = 1 OR LENGTH(current_classpath) = 0 THEN DO;
PUT "NOTE: Ignore any messages from the nearby statement(s)";
new_classpath = "&cp_addition";
END;
ELSE DO;
new_classpath = COMPRESS(current_classpath) ||
"&CP_path_separator" || "&cp_addition";
END;
CALL SYMPUTX('CP_new_classpath', STRIP(new_classpath),'GLOBAL');
RUN;
%PUT NOTE: Setting Java classpath to &CP_new_classpath;
OPTIONS SET=CLASSPATH "&CP_new_classpath";
%mend;
%macro reset_classpath;
%PUT NOTE: Setting Java classpath back to its
original state: &CP_orig_classpath;
OPTIONS SET=CLASSPATH "&CP_orig_classpath";
%mend;
%init_classpath_update;
%add_to_classpath(/u/siva/BatchJava/lib/apps/helloWorld.jar);
data _null_;
/* -- set length of variable to capture message ; */
length message $ 200 ;
/** -- initiate java object ; */
declare javaobj jobj ("helloWorld");
/* -- get message and clean up ; */
jobj.callStringMethod('getMessage', message);
jobj.delete();
put message = ;
run;
%reset_classpath;
Reference Link: http://www2.sas.com/proceedings/sugi30/241-30.pdf
Could some one help me out here .
Thanks ~