Example 2 – Compare and Output Control

Using the compare fields and the output fields can enhance the output information. The compare data for a decision request is either specified on the same line as the decision data or on the line immediately following the decision data. If specified on the same line as the decision data, the compare data must be prefixed with CD=. After making a decision request with the decision data, the values of the compare fields are compared against the compare data. If there is no compare data, this step is skipped. For each compare field, a trace line is sent out to the trace log informing the user that either the data matched, was different or the Business Rules Server did not return it. If the data is different, the expected data and actual data are also written.

In this example, compare and output fields were added to the first example. It uses one compare field (though there could be more).
Note: There is a subtle difference in the order of the output if compare data is specified on the same line instead of on the next line.
TF=c:/temp/PVRWorkflow.txt
WF=PVRWorkflow

IF=ibmSortType
IF=userField1,BYTE,5
DF=ibmNprAmount
DF=ibmNprPc
DF=ibmNprAccount
DF=ibmNprRT
DF=ibmNprExtProcCode
DF=ibmNprAuxOnUs
DF=myFlag,CHAR,1

ID=105,23

***** Comparison Fields
CF=ibmNprValidationError

***** Output Fields
OF=ibmNprOnUsFlag
OF=ibmNprValidAmount
OF=ibmNprValidPc
OF=ibmNprValidAccount
OF=ibmNprValidRT

DD=12301,1234,,5533-3333,,,Y, 
DD=12302,1234,,5566-6666,,,N, 
DD=12315,1234,12345678,021272655,2,,Y,   CD=0, 
DD=121,,3213212,12345-123,,232355,,    
CD=0,

================== Business Rules Trace Log =====================
----- Request:   1 = Init ------ Line   28 ----------------------
----- Request:   2 = Decision -- Line   41 ----------------------
Output Fields:
  'ibmNprOnUsFlag'       : [N]
  'ibmNprValidAmount'    : [1]
  'ibmNprValidPc'        : [1]
  'ibmNprValidAccount'   : [1]
  'ibmNprValidRT'        : [1]
----- Request:   3 = Decision -- Line   42 ----------------------
Output Fields:
  'ibmNprOnUsFlag'       : [N]
  'ibmNprValidAmount'    : [1]
  'ibmNprValidPc'        : [1]
  'ibmNprValidAccount'   : [1]
  'ibmNprValidRT'        : [1]
----- Request:   4 = Decision -- Line   43 ----------------------
Comparison Fields:
  'ibmNprValidationError': Different - Expected=[0] Actual=[1]
Output Fields:
  'ibmNprOnUsFlag'       : [Y]
  'ibmNprValidAmount'    : [0]
  'ibmNprValidPc'        : [1]
  'ibmNprValidAccount'   : [1]
  'ibmNprValidRT'        : [1]
----- Request:   5 = Decision -- Line   44 ----------------------
Output Fields:
  'ibmNprOnUsFlag'       : [N]
  'ibmNprValidAmount'    : [1]
  'ibmNprValidPc'        : [1]
  'ibmNprValidAccount'   : [1]
  'ibmNprValidRT'        : [1]
Comparison Fields:
  'ibmNprValidationError': Matches
----- Request:   6 = Term ------ Line   84 ----------------------
-------------------- Timing Summary (Init: 1) -------------------
            Count  Total       Average     Minimum     Maximum
Init:           1  00.237.113  
Decision:       4  00.054.914  00.013.728  00.004.499  00.034.742
Term:           1  00.000.532  
Server Total:      00.292.559
Simulator:         00.038.501
Overall Total:     00.331.060
Server/Overall:    88%
========================= End Of File ===========================