Java Clients
Java Connection Factory Language Service ExampleThe SAS language component of the IOM server allows you to submit SAS code for processing and to obtain output and information in the SAS log. The following example shows you how to do this, and also shows you how to use CORBA holder classes to handle output parameters. The following example assumes that you already have a reference (see Using the Java Connection Factory) to a workspace object. import com.sas.iom.SAS.ILanguageService; import com.sas.iom.SAS.ILanguageServicePackage.CarriageControlSeqHolder; import com.sas.iom.SAS.ILanguageServicePackage.LineTypeSeqHolder; import com.sas.iom.SAS.IWorkspace; import com.sas.iom.SASIOMDefs.StringSeqHolder; //use the Connection Factory to get a reference to a workspace object stub //IWorkspace iWorkspace = ... ILanguageService sasLanguage = iWorkspace.LanguageService(); sasLanguage.Submit("data a;x=1;run;proc print;run;"); CarriageControlSeqHolder logCarriageControlHldr = new CarriageControlSeqHolder(); LineTypeSeqHolder logLineTypeHldr = new LineTypeSeqHolder(); StringSeqHolder logHldr = new StringSeqHolder(); sasLanguage.FlushLogLines(Integer.MAX_VALUE,logCarriageControlHldr, logLineTypeHldr,logHldr); String[] logLines = logHldr.value; CarriageControlSeqHolder listCarriageControlHldr = new CarriageControlSeqHolder(); LineTypeSeqHolder listLineTypeHldr = new LineTypeSeqHolder(); StringSeqHolder listHldr = new StringSeqHolder(); sasLanguage.FlushListLines(Integer.MAX_VALUE,listCarriageControlHldr, listLineTypeHldr,listHldr); String[] listLines = listHldr.value;
In an effort to make the previous example more readable, we have removed most of the code structuring elements. The example will not compile as it is shown.
|