RunAsynch method: OptEngine class

Syntax

RunAsynch(TRANSACTION, PARM_PAIRS)

Description

The RunAsynch method requests the optimization engine to run the transaction in asynchronous mode.

When using the DetailedStatus OptEngine property, keep the following in mind:

  • The value returned by RunASynch is the operational status of the optimization engine.

  • The DetailedStatus OptEngine property indicates the completion status of the OptEngine method call RunASynch.

For example, RunASynch can return %OptEng_Fail and DetailedStatus is %OptEng_DB_Updates_Pending. For RunASynch, DetailedStatus can have the value:

  • %OptEng_Success: indicates that the function completed successfully.

  • %OptEng_Fail: indicates that the function failed.

  • %OptEng_Method_Disabled: indicates that the method is disabled or not valid.

  • %OptEng_DB_Updates_Pending: indicates that database updates are pending.

Parameters

Parameter Description

TRANSACTION

Enter a string for the name of the transaction to run.

PARAM_PAIRS

Enter the name and value pairs (string name and value) for this transaction. Not used if the transaction has no parameters. Parameters are defined in the analytic type definition.

See Optimization Framework: Configuring Analytic Type Transactions.

Returns

This method returns a constant. Valid values are:

Value Description

%OptEng_Success

Returned if method succeeds.

%OptEng_Fail

Returned if the method fails.

Example

This PeopleCode example runs an asynchronous optimization transaction named SOLVE. It has no input or output parameters. The SOLVE transaction solves the exercise scheduling problem and puts the results into the QE_RWSM_EXERSCH table.

Local OptEngine &myopt;
Local integer &status;
&myopt = GetOptEngine("PATSMITH");
/* Run the SOLVE transaction asynchronously with input values.  */
&status = &myopt.RunAsynch("SOLVE");
If &status=%OptEng_Fail Then
   QEOPT_WRK.MESSAGE_TEXT = "SOLVE transaction failed.";
   Return;
End-If;

The following example shows the use of the DetailedStatus property.

Local integer &status;
&status = myopt.RunAsynch("SOLVE");
if &status=%OptEng_Fail and &myopt.DetailedStatus=%OptEng_Method_Disabled then
   <perform some action>
End-if;