Try OpenEdge Now
skip to main content
Java Open Clients
Using the Open Client Java OpenAPI to Directly Access the AppServer : Passing parameters : Passing OUTPUT parameters
 

Passing OUTPUT parameters

Passing an OUTPUT parameter requires several steps to provide a parameter as output from an application service procedure or user-defined function, then to get the value returned by the parameter.
To pass an OUTPUT parameter:
1. Create a variable of the correct Java data type to hold the returned value for the parameter (see Creatingvariables for parameters).
2. Add the parameter to a ParamArray object (see Creatinga parameter array).
3. Run the procedure or user-defined function (see Running procedures and user-defined functions).
4. Get the value from the ParamArray (see GettingOUTPUT parameter values).
This example to passes an OUTPUT integer parameter that does not support the Unknown value (?).
Example: Passing an OUTPUT parameter using the Java OpenAPI
// Define the variable for the input-output parameter
// Using Integer object because the output value
//     is always returned as an Object
Integer CustomerNumber = new Integer(3);
// Create the ParamArray
ParamArray parms = new ParamArray(1);
// Set up output parameter - notice no variable is needed at this point
parms.addInteger(0, null, ParamArrayMode.OUTPUT);
// Run the procedure
...
// Fill output parameter
CustomerNumber = (Integer) parms.getOutputParameter(0);