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

Passing INPUT-OUTPUT parameters

Passing an INPUT-OUTPUT parameter requires several steps to provide a value as input to an application service procedure or user-defined function, then to return a value as output using the same parameter.
To pass an INPUT-OUTPUT parameter:
1. Create and initialize a variable for the parameter of the correct Java data type (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 output value from the ParamArray (see GettingOUTPUT parameter values). You might also want to reset the variable for reuse.
This example passes an INPUT-OUTPUT integer parameter that does not support the Unknown value (?).
Example: Passing an INPUT-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);

// Add the input-output parameter to the ParamArray
parms.addInteger(0, CustomerNumber, ParamArrayMode.INPUT_OUTPUT);

// Run the procedure
...

// Fill from output parameter - must cast from Object
CustomerNumber = (Integer) parms.getOutputParameter(0);