LogiView

Interfaces to system variables

If the life span of the system variables is extended the possibility exists of writing system variables before and after the start of the decision table system or querying their values if their life span is extended. In this way preallocations can be made or calculated values can be reused.

Initializing and releasing system variables

The functions Initialize variables and Reset variables (for extending the life span/resetting life span and deleting values ) can not only be called up interactively but also from a DataView application.

int

lgv_usx_sys_ini ()
Initializing system variables: extending the life span. Initialization of the values of the system variables during which values may be present are first released. The function provides 1 for an error, otherwise 0.

int

lgv_usx_sys_clr ()
Releasing system variables: resetting the life span. Releasing values of the system variables. The function provides 1 for an error, otherwise 0.

int

lgv_usx_sys_get_ini ()
Checks if the system variable is already initialized. In this case the function provides the value 1, otherwise 0.

       

After the system table with the function 'lgv_usx_sys_ini' has been initialized, the values of the system variables are only released once the function 'lgv_usx_sys_clr' is called up, even if the execution has been completed ( extended life span). The execution is called up with the usual user exits ('lgv_sel_run', 'lgv_nosel_run'...).

If the system table is initialized at the beginning of a session it is possible to access all initially occupied values of the system variables in all decision table runs as long as 'lgv_usx_sys_clr' or 'lgv_usx_sys_ini' are not called up.

Access to system variables

char

lgv_sys_get_typ(var_nam)
This function provides the type of a system variable:

  • 'I' = Integer
  • 'F' = Float
  • 'S' = String
  • 'L' = Logic
  • ' ' = Variable does not exist

int

lgv_sys_get_knw(var_nam)
This function checks if the system variable specified is occupied:

  • 0 = Variable is occupied
  • -1 = Variable is not occupied
  • 1 = Variable does not exist
       

In order to read out global system variables the following functions are available:

long

lgv_sys_int_rea(var_nam)
Provides the value of a float variable (0 for error)

double

lgv_sys_flo_rea(var_nam)
Provides the value of a float variable (0.0 for error)

char*

lgv_sys_str_rea(var_nam)
Provides the value of a string variable (ZERO pointer for error

char

lgv_sys_log_rea(var_nam)
Provides the value of a logic variable ('y' = TRUE, 'n' = FALSE, ' ' = error)

       

Please note that when reading a system variable which is so far unoccupied the value is to be determined. This takes place by executing a database access present or by querying the value (standard query form).

In order to fill in system variables the following functions are available:

int

lgv_sys_int_wri(int,var_nam)
Occupies a system variable with an integer value. If the variable does not exist or has another type the function provides the value 1, otherwise 0.

int

lgv_sys_flo_wri(flo,var_nam)
Occupies a system variable with a float value. If the variable does not exist or has another type the function provides the value 1, otherwise 0.

int

lgv_sys_str_wri(str,var_nam)
Occupies a system variable with the string value. If the variable does not exist or has another type the function provides the value 1, otherwise 0.

int

lgv_sys_log_wri(log,var_nam)
Occupies a system variable with a logic value ( 'y' for TRUE, 'n' for FALSE). If the variable does not exist or has another type the function provides the value 1, otherwise.

       

The arguments of the above functions have the following meaning:

var_nam

Name of a system variable of the type 'char*'
(For array elements the index is added on to the names analog to the method in the decision tables, e.g. ALPHA[5].)

int

Value of a variable of the user exit of type 'int'

flo

Value of a variable of the user exit of type 'float'

str

Value of a variable of the user exit of type 'char*'

log

Value of a variable of the user exit of 'char' (permissible values are 'y' = logic value TRUE and 'n' = logic value FALSE)

       

Example:

Within a user exit the call up of functions for reading and writing the system variables can take place as follows:

...

int i_ini; /* Initialization flag.*/
int i_rc; /* Return-Code */
int i_value; /* Value Int-Variable */
float f_value; /* Value Float-Var. */

/* Initialize system variables if necessary */
if ((i_ini = lgv_sys_get_ini()) == 0)
{
if (lgv_usx_sys_ini() != 0)
return (1);
}
/* String variable 'WRKSHP' with the value */
i_rc=lgv_sys_str_wri ("St 37", "WRKSHP");
/* Float variable 'WEIGHT' write */
f_value = 3.45;
i_rc= lgv_sys_flo_wri (f_value, "WEIGHT");
.
.
/* Start decision table */
.
.
/* Value of integer var. 'ALPHA' with Index 5 (Array element!) read */
i_value = lgv_sys_int_rea ("ALPHA[5]");
.
.
/* Release system variable if necessary */
if (i_ini==0)
lgv_usx_sys_clr();
...