GetOptEngine function

Syntax

GetOptEngine(probinst[,&detailedstatus])

Description

The GetOptEngine function returns a handle to an optimization engine that is already loaded with the analytic instance.

Note:

You cannot call GetOptEngine from a domain other than the application server.

Parameters

Parameter Description

probinst

Enter the analytic instance ID, which is unique ID for this analytic instance in this optimization engine.

&detailedstatus

(Optional) This status reference parameter returns an integer value giving further information about the evaluation of this function. The value returned is one of the following:

  • %OptEng_Success: The function completed successfully.

  • %OptEng_Fail: The function failed.

  • %OptEng_Invalid_Piid: The analytic instance ID passed to the function is invalid.

Returns

Returns an OptEngine PeopleCode object if successful, a null value otherwise.

Example

The following example causes an optimization engine to shut down its analytic instance:

Global string &probinst;
Local OptEngine &myopt;
Local integer &status;

&myopt = GetOptEngine(&probinst);
If &myopt <> NULL then
&status = &myopt.ShutDown();
QEOPT_WRK.MESSAGE_TEXT = "Analytic Instance ID " | &probinst 
 | " has been shutdown successfully.";
End-if;

Or, you can use the optional status parameter:

&myopt = GetOptEngine(&probinst, &detailedstatus);
if &myopt=NULL and &detailedstatus=%OptEng_Invalid_Piid then
     /* perform some action */
End-if;