Input and Output Parameters

Input Parameters

Input parameters enable you to pass values to a stored process. The default value of an input parameter, if it is defined, is in the metadata for the stored process.
If a default value is defined for an input parameter, and the data type of the value is text or numeric (integer or floating-point), the input parameter is set to the default value.
If there is no default value defined for an input parameter, or if the type of the input parameter is not text or numeric, then the input parameter is set to REPLACE_WITH_ACTUAL_VALUE_FOR_PROMPT_YYY, where YYY is the name of the input parameter. This fabricated text causes a compiler error that is listed in the Eclipse Markers view. To build the project, replace the text with a valid value for that input parameter.
Note that the input parameter values are declared as class instance variables. When these particular input parameter declarations appear within a servlet, the values should be specified as constants that will be used for all requests to the servlet. If you want to update the servlet code to obtain input parameter values from request parameters, do not to store the input parameter values in these class instance variables because there will be collisions if there are concurrent requests to the servlet. Instead, use local variables to hold request parameter values.
Input parameters are represented as prompts in SAS Management Console. To examine the metadata for an input parameter, including its type and default value, follow these steps while using SAS Management Console:
  1. Right-click the stored process and select Properties.
  2. Change to the Parameters tab.
  3. Select a prompt (input parameter) and click Edit.
  4. Change to the Prompt Type and Values tab.
For more information about stored processes and input parameters, see the following resources:
  • the comments in the generated code (StoredProcessDriver.java or StoredProcessDriverServlet.java).
  • the SAS Stored Processes: Developer's Guide available on the SAS Integration Technologies documentation page at http://support.sas.com/documentation/onlinedoc/inttech/, in particular Appendix 3, “Formatting Prompt Values and Generating Macro Variables from Prompts”.
  • the SAS Foundation Services Javadoc contained in the SAS BI API Documentation on the SAS AppDev Studio Developer’s Site at http://support.sas.com/rnd/appdev/. In particular, examine the package summary for com.sas.services.storedprocess.

Output Parameters

SAS Stored Processes can return results to a client via output parameters. Output parameters are defined in the metadata for a stored process using SAS Management Console. When a stored process returns output parameters, you can retrieve the values from the StoredProcessFacade with the getOutputParametersWithValues() method. The values are returned in a java.util.List.
An example of retrieving the output parameter values from the StoredProcessFacade and writing the results to the output file can be found in the main driver class of the Stored Process Java Client template.
An example of retrieving the output parameter values from the StoredProcessFacade and writing the results to the browser can be found in the main driver servlet class of the Stored Process Servlet template.
In both examples, you can modify the processing of the output parameter results as appropriate to the SAS Stored Process executed in the example.
For a more detailed explanation of output parameters, see “Using Output Parameters” in the SAS Stored Processes Developer’s Guide available on the SAS Integration Technologies documentation page at http://support.sas.com/documentation/onlinedoc/inttech/.