MAC-PAC Homecontact ussupport login 
Documentation > MAC-PAC Reference Library > Distribution > Expert Configurator > Key Concepts and Procedures > External Program Variable

External Program Variable

 

The Expert Configurator has the capability to call an external program to retrieve a value and use it in configuration.  This is done using the external program variable.  When an external program variable is encountered in rules processing, the program is called and the value that is returned is used in the expression.  The external program is not restricted to a specific language or process.  It must, however, be designed to communicate with the Expert Configurator.

The following is the parameter list in the order they are used.  The type, length, and decimal precision (for numeric variables) are also shown.

 

Sales Order Number

Alphanumeric, 6

Sales Order Release Number

numeric, 2.0, zoned

Sales Order Line Number

numeric, 3.0, packed

Variable Type

alphanumeric, 1

Variable Value

alphanumeric, 15

      Parameter List for the External Program Variable in the Order they Are Used.

 The parameter type, length, and decimal precision (for numeric variables) are also shown.

The sales order fields are passed to allow the external program to retrieve additional information based on the sales order.  When retrieving additional sales order line information, the Sales Order Line Workfile (EC210AP) should be used in order to retrieve the current data.

The Variable Type and Variable Value fields are used to return data from the external program to the Expert Configurator.  All variable types defined in Reference File category Y01 are valid values for the Variable Type field.  In addition, alphanumeric (A), numeric (N), and logical (L) variables may be used.  The Variable Value field should contain the data associated with the Variable Type field.  For example, if the program determines a matrix variable, the variable type code for matrix (defined in the Reference File) should be moved to the Variable Type variable, and the matrix name should be moved to the Variable Value variable.

If a numeric value is to be passed from the external program to the Expert Configurator, it must be formatted in the following manner.  The value must first be formatted as a signed numeric field of length 14, decimal precision 6.  That variable must then be moved into the Variable Value field.  Also, the numeric variable code (N) must be placed in the Variable Type variable.  Once passed back from the calling program, the Expert Configurator will convert the alphanumeric field to numeric if the Variable Type is set to numeric.

Note that you can add up to 20 other parameters to the parameter list by defining a create parameters rule.  Each of the parameters can be either numeric or alphanumeric, and each parameter can be up to 15 characters long.  The parameters created by the rule are inserted in the parameter list between the Sales Order Line Number and the Variable Type.

File exception and error processing is the responsibility of the external program.  One way to handle an unsuccessful retrieval is to pass an error value (ERROR), for example to the Variable Value field and the alphanumeric code (A) to the Variable Type field.  Then, rules can be defined to check for the error value and process accordingly.