SAS 9.1.3 Integration Technologies » Developer's Guide


SAS Stored Processes
Implementing a Repository
Creating a Stored Process
Invoking a Stored Process
Publishing Stored Process Results
Working with Stored Process Results in the Client Application
IOM Direct Interface Stored Processes

Invoking a Stored Process

Using the IOM StoredProcessService to invoke a stored process from a client application is straightforward. You first define the location of the repository. You do this by setting the Repository property of the StoredProcessService.

For example, if you are using file system objects to implement the repository and have allocated a UNIX directory of /SASPrograms/StoredProcesses to hold your programs, the following Visual Basic code sets the repository property of the StoredProcessService.

   Dim sp as SAS.StoredProcessService
   Set sp = obWS.LanguageService.StoredProcessService
   sp.Repository = "file:/SASPrograms/StoredProcesses"

Note: This assumes that you already have a reference (obWS in this case) to a Workspace object. Please see Working With Object Variables and Creating a Workspace for details on how to obtain this reference.

Then, to execute a stored process on the server, you invoke the Execute method and pass the filename of the stored process as well as any required name/value parameters to be used in this execution of the stored process.

For example, if the stored process shown in the example above was in a file named SP01, you might invoke it using the following Visual Basic code:

   sp.Execute "SP01", "tempdir=scratch 
      source=salesdata intable=monthly  _
      svar=sales filter=MONTH=MAY 
      outtitle=Monthly Sales Data"