SAS 9.1.3 Integration Technologies » Developer's Guide


Using the Java Workspace Factory
Connecting with Directly Supplied Server Attributes
Connecting with Server Attributes Read from an LDAP Server
Language Service Example
Returning a Workspace to the Java Workspace Factory
Java Clients

Java Workspace Factory Language Service Example



The 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 to a workspace component.
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 workspace factory to get reference to workspace stub
//IWorkspace sasWorkspace = ...
ILanguageService sasLanguage = sasWorkspace.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;
For the sake of clarity, all exception handling statements have been removed from the preceding example. The example will not compile as shown.