Contents Using the IOM Server Previous Next

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.

Contents Using the IOM Server Previous Next