OptEngine Class Methods

This section discusses the optimization methods for the OptEngine PeopleCode class. The methods are listed in alphabetical order.

Syntax

CheckOptEngineStatus()

Description

The CheckOptEngineStatus method returns the status of the optimization engine, using a combination of its return value and the DetailedStatus OptEngine class property. Keep the following in mind:

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

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

For example, CheckOptEngineStatus can return %OptEng_Idle and DetailedStatus is %OptEng_Success. For CheckOptEngineStatus, DetailedStatus can have the value:

  • %OptEng_Success

  • %OptEng_Fail

  • %OptEng_Not_Available

Note: Before this method is called, the CreateOptEngine or GetOptEngine must be called.

Returns

Returns an integer for the status of the optimization engine. These numbers are message IDs belonging to message set 148 in the message catalog.

Numeric Value

Constant Value

Description

21

%OptEng_Not_Loaded

The optimization engine process is running, but is not currently loaded with an application problem.

22

%OptEng_Busy_Loading

The optimization engine is busy loading an application problem. It will not accept transaction requests until loading completes.

23

%OptEng_Idle

The optimization engine is loaded with an application problem and waiting for a transaction request.

24

%OptEng_Busy

The optimization engine is busy processing a transaction request for the loaded application problem. It will not accept additional transaction requests until the current one completes.

26

%OptEng_Unknown

An error has occurred. The optimization engine status cannot be determined.

Example

This PeopleCode example shows optimization engine status being checked:

Local OptEngine &myopt;
Local string &probinst;
Local integer &status;
&myopt = GetOptEngine("PATSMITH");
/* Initialize the DESCRLONG field in the QE_FUNCLIB_OPT record to null.  */
GetLevel0().GetRow(1).GetRecord(Record.QE_FUNCLIB_OPT).DESCRLONG.Value = "";
&status = &myopt.CheckOptEngineStatus();
GetLevel0().GetRow(1).GetRecord(Record.QE_FUNCLIB_OPT).DESCRLONG.Value = "Opt
Engine status = " | MsgGet(148, &status, "Could not send to the OptEngine.");

You can also retrieve the detailed status:

Local integer &detailedstatus
&status = &myopt.CheckOptEngineStatus();
&detailedstatus = &myopt.DetailedStatus;

Syntax

FillRowset(PARAM_NAME, &Rowset[, &functionstatus])

Description

This method gets the value of a transaction output parameter that is a rowset. This cannot be used with the RunAsynch method; RunSynch is needed to make the transaction output parameter values immediately available.

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

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

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

For example, FillRowset returns %OptEng_Fail, and DetailedStatus is %OptEng_Method_Disabled.

For FillRowset, the DetailedStatus property can have the value:

  • %OptEng_Success.

  • %OptEng_Fail.

  • %OptEng_Method_Disabled.

    This indicates that the method is disabled or not valid.

  • %OptEng_Wrong_Parm_Type

Parameters

Field or Control

Definition

PARAM_NAME

Enter a string for the name of the output parameter to get from the transaction that was just performed with RunSynch. This parameter must be defined as an output or both (input and output) in the analytic type definition.

See Configuring Analytic Type Transactions.

&Rowset

Enter the rowset containing the values. This rowset must be a single record rowset, and the record must match the record name associated with the transaction parameter in the analytic type definition.

&functionstatus

(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_Method_Disabled: A method is disabled or not valid.

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

The following PeopleCode example runs a synchronous optimization transaction named RETURN_MACHINE_UNAVAILABLE. It has these parameters:

  • Input: MACHINE_NAME to specify the machine for which we need unavailable times.

  • Output: RETURN_TIMES to specify a rowset and MACHINE_WRK record containing the BEGIN_DATE and END_DATE fields.

This PeopleCode example sets input parameter values and gets an output parameter value:

Local OptEngine &myopt;
Local integer &status;
Local string &machname;
Local Rowset &rs;
&myopt = GetOptEngine("PATSMITH");
&machname = QEOPT_WRK.MACHINE_NAME.Value;
/* Run the RETURN_MACHINE_UNAVAILABLE transaction synchronously with input values.
  */
&status = &myopt.RunSynch("RETURN_MACHINE_UNAVAILABLE", "MACHINE_NAME", &machname);
If Not &status Then
   QEOPT_WRK.MESSAGE_TEXT = " RETURN_MACHINE_UNAVAILABLE transaction failed.";
   Return;
End-If;
/* Get output value from the RETURN_MACHINE_UNAVAILABLE transaction.  */
&rs = CreateRowset(Record.MACHINE_WRK);
&status = &myopt.FillRowset("RETURN_TIMES", &rs);

You can also use the [new->] DetailedStatus property as follows:

&status = &myopt.FillRowset("RETURN_TIMES", &rs);
if &status=%OptEng_Fail and &myopt.DetailedStatus=%OptEng_Method_Disabled then
    /* perform some action */
End-if;

Syntax

GetDate(PARAM_NAME[, &status])

Description

This method gets the value of a transaction output parameter with a data type of Date. This cannot be used with the RunAsynch method; RunSynch is needed to make the transaction output parameter values immediately available.

The OptEngine DetailedStatus property indicates the completion status of the OptEngine method call GetDate. For GetDate, DetailedStatus can have the value:

  • %OptEng_Success.

  • %OptEng_Fail.

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

Parameters

Field or Control

Definition

PARAM_NAME

Enter a string for the name of the output parameter to get from the transaction that was just performed with RunSynch. This parameter must be defined as an output or both (input and output) in the analytic type definition.

See Configuring Analytic Type Transactions.

Returns

Returns a Date object; use this method when that is the data type of the transaction output parameter value.

Example

See GetNumber.

Syntax

GetDateArray(PARAM_NAME)

Description

This method gets the value of a transaction output parameter with a data type Array of Date. This cannot be used with the RunAsynch method; RunSynch is needed to make the transaction output parameter values immediately available.

The OptEngine DetailedStatus property indicates the completion status of the OptEngine method call GetDateArray. For GetDateArray, DetailedStatus can have the value:

  • %OptEng_Success.

  • %OptEng_Fail.

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

Parameters

Field or Control

Definition

PARAM_NAME

Enter a string for the name of the output parameter to get from the transaction that was just performed with RunSynch. This parameter must be defined as an output or both (input and output) in the analytic type definition.

See Configuring Analytic Type Transactions.

Returns

Returns an Array of Date object; use this method when that is the data type of the transaction output parameter value.

Example

See GetStringArray.

Syntax

GetDateTime(PARAM_NAME)

Description

This method gets the value of a transaction output parameter with a data type of DateTime. This cannot be used with the RunAsynch method; RunSynch is needed to make the transaction output parameter values immediately available.

The DetailedStatus OptEngine property indicates the completion status of the OptEngine method call GetDateTime. For GetDateTime, DetailedStatus can have the value:

  • %OptEng_Success.

  • %OptEng_Fail.

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

Parameters

Field or Control

Definition

PARAM_NAME

Enter a string for the name of the output parameter to get from the transaction that was just performed with RunSynch. This parameter must be defined as an output or both (input and output) in the analytic type definition.

See Configuring Analytic Type Transactions.

Returns

Returns a DateTime object; use this method when that is the data type of the transaction output parameter value.

Example

See GetNumber.

Syntax

GetDateTimeArray(PARAM_NAME)

Description

This method gets the value of a transaction output parameter with a data type Array of DateTime. This cannot be used with the RunAsynch method; RunSynch is needed to make the transaction output parameter values immediately available.

The DetailedStatus OptEngine property indicates the completion status of the OptEngine method call GetDateTimeArray. For GetDateTimeArray, DetailedStatus can have the value:

  • %OptEng_Success.

  • %OptEng_Fail.

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

Parameters

Field or Control

Definition

PARAM_NAME

Enter a string for the name of the output parameter to get from the transaction that was just performed with RunSynch. This parameter must be defined as an output or both (input and output) in the analytic type definition.

See Configuring Analytic Type Transactions.

Returns

Returns an Array of DateTime object; use this method when that is the data type of the transaction output parameter value.

Example

See GetStringArray.

Syntax

GetNumber(PARAM_NAME)

Description

This method gets the value of a transaction output parameter with a data type of Number. This cannot be used with the RunAsynch method; RunSynch is needed to make the transaction output parameter values immediately available.

The DetailedStatus OptEngine property indicates the completion status of the OptEngine method call GetNumber. For GetNumber, DetailedStatus can have the value:

  • %OptEng_Success.

  • %OptEng_Fail.

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

Parameters

Field or Control

Definition

PARAM_NAME

Enter a string for the name of the output parameter to get from the transaction that was just performed with RunSynch. This parameter must be defined as an output or both (input and output) in the analytic type definition.

See Configuring Analytic Type Transactions.

Returns

Returns a Number object; use this method when that is the data type of the transaction output parameter value.

Example

The following PeopleCode example runs a synchronous optimization transaction named IS_MACHINE_AVAILABLE. It has these parameters:

  • Input MACHINE_NAME to specify the machine.

  • Inputs BEGIN_DATE and END_DATE to specify the time slot.

  • Output AVAILABLE_FLAG to specify whether the machine is available in that time slot.

This PeopleCode example sets input parameter values and gets an output parameter value:

Local OptEngine &myopt;
Local integer &status;
Local string &machname;
Local datetime &begindate;
Local datetime &enddate;
&myopt = GetOptEngine("PATSMITH");
&machname = QEOPT_WRK.MACHINE_NAME.Value;
&begindate = QEOPT_WRK.BEGIN_DATE.Value;
&enddate = QEOPT_WRK.END_DATE.Value;
/* Run the IS_MACHINE_AVAILABLE transaction synchronously with input values.  */
&status = &myopt.RunSynch("IS_MACHINE_AVAILABLE", "MACHINE_NAME",
 &machname, "BEGIN_DATE", &begindate, "END_DATE", &enddate);
If Not &status Then
   QEOPT_WRK.MESSAGE_TEXT = "IS_MACHINE_AVAILABLE transaction failed.";
   Return;
End-If;
/* Get output value from the IS_MACHINE_AVAILABLE transaction.  */
QEOPT_WRK.AVAILABLE_FLAG = &myopt.GetNumber("AVAILABLE_FLAG");

You can use the DetailedStatus property as follows:

QEOPT_WRK.AVAILABLE_FLAG = &myopt.GetNumber("AVAILABLE_FLAG");
if &myopt.DetailedStatus=%OptEng_Fail then
   /* perform some action */
End-if;

Syntax

GetNumberArray(PARAM_NAME)

Description

This method gets the value of a transaction output parameter with a data type Array of Number. This cannot be used with the RunAsynch method; RunSynch is needed to make the transaction output parameter values immediately available.

The DetailedStatus OptEngine property indicates the completion status of the OptEngine method call GetNumberArray. For GetNumberArray, DetailedStatus can have the value:

  • %OptEng_Success.

  • %OptEng_Fail.

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

Note: Do not pass an array of type Integer as a transaction parameter. Use an array of type Number instead.

Parameters

Field or Control

Definition

PARAM_NAME

Enter a string for the name of the output parameter to get from the transaction that was just performed with RunSynch. This parameter must be defined as an output or both (input and output) in the analytic type definition.

See Configuring Analytic Type Transactions.

Returns

Returns an Array of Number object; use this method when that is the data type of the transaction output parameter value.

Example

See GetStringArray.

Syntax

GetString(PARAM_NAME)

Description

This method gets the value of a transaction output parameter with a data type of String. This cannot be used with the RunAsynch method; RunSynch is needed to make the transaction output parameter values immediately available.

The DetailedStatus OptEngine property indicates the completion status of the OptEngine method call GetString. For GetString, DetailedStatus can have the value:

  • %OptEng_Success.

  • %OptEng_Fail.

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

Parameters

Field or Control

Definition

PARAM_NAME

Enter a string for the name of the output parameter to get from the transaction that was just performed with RunSynch. This parameter must be defined as an output or both (input and output) in the analytic type definition.

See Configuring Analytic Type Transactions.

Returns

Returns a String object; use this method when that is the data type of the transaction output parameter value.

Example

See GetNumber.

Syntax

GetStringArray(PARAM_NAME)

Description

This method gets the value of a transaction output parameter with a data type Array of String. This cannot be used with the RunAsynch method; RunSynch is needed to make the transaction output parameter values immediately available.

The DetailedStatus OptEngine property indicates the completion status of the OptEngine method call GetStringArray. For GetStringArray, DetailedStatus can have the value:

  • %OptEng_Success.

  • %OptEng_Fail.

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

Parameters

Field or Control

Definition

PARAM_NAME

Enter a string for the name of the output parameter to get from the transaction that was just performed with RunSynch. This parameter must be defined as an output or both (input and output) in the analytic type definition.

See Configuring Analytic Type Transactions.

Returns

Returns an Array of String object; use this method when that is the data type of the transaction output parameter value.

Example

The following PeopleCode example runs a synchronous optimization transaction named ARE_MACHINES_AVAILABLE. It has these parameters:

  • Inputs BEGIN_DATE and END_DATE to specify the time slot.

  • Output MACHINE_NAMES to specify the machines available in that time slot.

This PeopleCode example sets input parameter values and gets an output parameter value:

Local OptEngine &myopt;
Local integer &status;
Local array of string &machnames;
Local datetime &begindate;
Local datetime &enddate;
&myopt = GetOptEngine("PATSMITH");
&begindate = QEOPT_WRK.BEGIN_DATE.Value;
&enddate = QEOPT_WRK.END_DATE.Value;
/* Run the ARE_MACHINES_AVAILABLE transaction synchronously with input values.  */
&status = &myopt.RunSynch("ARE_MACHINES_AVAILABLE",
 "BEGIN_DATE", &begindate, "END_DATE", &enddate);
If &status=%OptEng_Fail Then
   QEOPT_WRK.MESSAGE_TEXT = "ARE_MACHINES_AVAILABLE transaction failed.";
   Return;
End-If;
/* Get output value from the ARE_MACHINES_AVAILABLE transaction.  */
&machnames = &myopt.GetStringArray("MACHINE_NAMES");

The following example shows the use of the DetailedStatus property:

Local array of string &machnames;
&machnames = &myopt.GetStringArray("MACHINE_NAMES");
if &myopt.DetailedStatus=%OptEng_Fail then
   /* perform some action */
End-if;

Syntax

GetTime(PARAM_NAME)

Description

This method gets the value of a transaction output parameter with a data type of Time. This cannot be used with the RunAsynch method; RunSynch is needed to make the transaction output parameter values immediately available.

The DetailedStatus OptEngine property indicates the completion status of the OptEngine method call GetTime. For GetTime, DetailedStatus can have the value:

  • %OptEng_Success.

  • %OptEng_Fail.

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

Parameters

Field or Control

Definition

PARAM_NAME

Enter a string for the name of the output parameter to get from the transaction that was just performed with RunSynch. This parameter must be defined as an output or both (input and output) in the analytic type definition.

See Configuring Analytic Type Transactions.

Returns

Returns a Time object; use this method when that is the data type of the transaction output parameter value.

Example

See GetNumber.

Syntax

GetTimeArray(PARAM_NAME)

Description

This method gets the value of a transaction output parameter with a data type Array of Time. This cannot be used with the RunAsynch method; RunSynch is needed to make the transaction output parameter values immediately available.

The DetailedStatus OptEngine property indicates the completion status of the OptEngine method call GetTimeArray. For GetTimeArray, DetailedStatus can have the value:

  • %OptEng_Success.

  • %OptEng_Fail.

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

Parameters

Field or Control

Definition

PARAM_NAME

Enter a string for the name of the output parameter to get from the transaction that was just performed with RunSynch. This parameter must be defined as an output or both (input and output) in the analytic type definition.

See Configuring Analytic Type Transactions.

Returns

Returns an Array of Time object; use this method when that is the data type of the transaction output parameter value.

Example

See GetStringArray.

Syntax

GetTraceLevel(component)

Description

GetTraceLevel gets the severity level at which events are logged for a given component.

The DetailedStatus OptEngine property indicates the completion status of the OptEngine method call GetTraceLevel. For GetTraceLevel, DetailedStatus can have the value:

  • %OptEng_Success.

    This indicates that the function completed successfully.

  • %OptEng_Fail.

    This indicates that the function failed.

  • %OptEng_Method_Disabled.

    This indicates that the method is disabled or not valid.

  • %OptEng_DB_Updates_Pending.

    This indicates that database updates are pending.

Parameters

Field or Control

Definition

component

Enter one of the following PeopleCode constants: Opt_Engine, Opt_Utility, Opt_Datacache, or Opt_Plugin.

Returns

Returns one of the following.

  • %Severity_Fatal

  • %Severity_Status

  • %Severity_Error

  • %Severity_Warn

  • %Severity_Info

  • %Severity_Trace1

  • %Severity_Trace2

Example

Local OptEngine &myopt; 
Local integer &tracelevel;

&myopt = GetOptEngine("PATSMITH");  

&tracelevel = &myopt.GetTraceLevel(%Opt_Engine);
if &myopt.DetailedStatus = %OptEng_Success then

   if (&tracelevel = %Severity_Info_ then
      winmessage("Severity level for the OptEngine is 'Info'");
   End-if;
End-if;

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

Field or Control

Definition

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 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;

Syntax

RunSynch(TRANSACTION, PARM_PAIRS)

Description

The RunSynch method requests the optimization engine to run the transaction in synchronous mode.

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

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

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

For example, RunSynch can return %OptEng_Fail and DetailedStatus is %OptEng_DB_Updates_Pending. For RunSynch, 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

Field or Control

Definition

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 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

The following PeopleCode example runs a synchronous optimization transaction named IS_MACHINE_AVAILABLE. It has these parameters:

  • Input MACHINE_NAME to specify the machine.

  • Inputs BEGIN_DATE and END_DATE to specify the time slot.

  • Output AVAILABLE_FLAG to specify whether the machine is available in that time slot.

This PeopleCode example sets input parameter values and gets an output parameter value:

Local OptEngine &myopt;
Local integer &status;
Local string &machname;
Local datetime &begindate;
Local datetime &enddate;
&myopt = GetOptEngine("PATSMITH");
&machname = QEOPT_WRK.MACHINE_NAME.Value;
&begindate = QEOPT_WRK.BEGIN_DATE.Value;
&enddate = QEOPT_WRK.END_DATE.Value;
/* Run the IS_MACHINE_AVAILABLE transaction synchronously with input values.  */
&status = &myopt.RunSynch("IS_MACHINE_AVAILABLE",
 "MACHINE_NAME", &machname, "BEGIN_DATE", &begindate, "END_DATE", &enddate);
If &status=%OptEng_Fail Then
   QEOPT_WRK.MESSAGE_TEXT = "IS_MACHINE_AVAILABLE transaction failed.";
   Return;
End-If;
/* Get output value from the IS_MACHINE_AVAILABLE transaction.  */
QEOPT_WRK.AVAILABLE_FLAG = &myopt.GetNumber("AVAILABLE_FLAG");

Or, the following example shows the use of the DetailedStatus property.

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

Syntax

SetTraceLevel(component, severity )

Description

SetTraceLevel sets the severity level at which events are logged for a given component.

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

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

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

For example, SetTraceLevel can return %OptEng_Fail and DetailedStatus is %OptEng_DB_Updates_Pending. For SetTraceLevel, 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

Field or Control

Definition

component

Use one of the following PeopleCode constants: Opt_Engine, Opt_Utility, Opt_Datacache, or Opt_Plugin.

severity

Use one of the following PeopleCode constants. These options set the degree to which errors are logged. You can set the tracing levels differently for various parts of your program. This enables you to control the amount of trace information that your program generates.

The following list shows the order of the severity, starting with the highest level. For example, %Severity_Error logs %Severity_Fatal, %Severity_Status, and %Severity_Error messages, while the system filters out other messages. Keep in mind that the higher the severity, the greater the performance overhead.

  • %Severity_Fatal

  • %Severity_Status

  • %Severity_Error

  • %Severity_Warn

  • %Severity_Info

  • %Severity_Trace1

  • %Severity_Trace2

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

Local OptEngine &myopt; 
Local integer &status;  
Local string &machname; 
Local datetime &begindate; 
Local datetime &enddate;
 
&myopt = GetOptEngine("PATSMITH");  

&status = &myopt.SetTraceLevel(%Opt_Engine, %Severity_Warn);  
if &status = %OptEng_Fail then
   <example: notify user that set trace action has failed> 
End-if;

Syntax

ShutDown()

Description

The ShutDown method requests the optimization engine to shut down.

If the optimization engine cannot be contacted for shutdown, the return status is %OptEng_Fail and the DetailedStatus property is OptEng_Not_Available.

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

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

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

For example, Shutdown can return %OptEng_Fail and DetailedStatus is %OptEng_DB_Updates_Pending. For Shutdown, 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.

Note: Before this method is called, CreateOptEngine or GetOptEngine must be called. Call ShutDown to shut down optimization engines even when running in Application Engine.

Parameters

None.

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 shows an optimization engine being shut down:

Local OptEngine &myopt;
Local integer &status;
&myopt = GetOptEngine("PATSMITH");
/* Shut down the optimization engine */
&status = &myopt.ShutDown();
If &status=%OptEng_Fail Then
   QEOPT_WRK.MESSAGE_TEXT = "PATSMITH optimization engine shutdown failed.";
   Return;
Else
   QEOPT_WRK.MESSAGE_TEXT = "PATSMITH optimization engine shutdown successful.";
   Return;
End-If;

The following example shows the use of the DetailedStatus property:

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