FUNCTION GetTotalOrdersByNumber RETURNS INTEGER (CustNum AS INTEGER, threshold AS DECIMAL):
... END. |
import com.progress.open4gl.javaproxy.*;
import com.progress.open4gl.Parameter; import com.progress.open4gl.ProcedureType; public class sampleClient { private static final java.lang.String tName = new String( "KM_client" ); public static void singleRunProcedure() { try // To catch all exceptions { // Connect to the AppServer Connection myConn = new Connection("","",""); OpenAppObject dynAO = new OpenAppObject(myConn, "asbroker2"); // Run procedure as single-run OpenProcObject dynPO = dynAO.createPO("CustomerInfo.p", ProcedureType.SINGLE_RUN); // Display procedure type using getProcedureType method System.out.println("Procedure object procedure type: " + dynPO.getProcedureType()); // Call UDF // First set up parameters int custNum = 3; java.math.BigDecimal threshold = new java.math.BigDecimal(1000); Integer retVal; // Set up input parameters ParamArray parms = new ParamArray(2); parms.addInteger(0, custNum, ParamArrayMode.INPUT); parms.addDecimal(1, threshold, ParamArrayMode.INPUT); // Set up return type parms.setReturnType(Parameter.PRO_INTEGER); // Run UDF dynPO.runProc("GetTotalOrdersByNumber", parms); // Get return value retVal = (Integer)(parms.getReturnValue()); // Even though the single-run procedure has been deleted on the // AppServer, use _release() to clean up the resources on the client. dynPO._release(); dynAO._release(); } // try to catch all unexpected exceptions catch ( Exception e ) { System.out.println("Exception in sample2()"); System.out.println("Exception Message: " + e.getMessage()); e.printStackTrace(); } } } // class |