Oracle® OLAP DML Reference 11g Release 2 (11.2) Part Number E17122-07 |
|
|
PDF · Mobi · ePub |
The MODTRACE option controls whether each equation in a model is recorded in a file during execution of the model. MODTRACE is used primarily as a debugging tool to uncover problems by tracing the execution of a model.
Tip:
The INFO function lets you obtain specific items of information about the structure of the compiled model and the solution status of a model you have run. See INFO (MODEL).BOOLEAN
MODTRACE = {YES|NO}
Oracle OLAP sends the text of each model equation to the current outfile before calculating the model equation, and then sends the results of the calculation to the current outfile.
When you have used a DBGOUTFILE statement to specify a debugging file, Oracle OLAP sends MODTRACE output to the debugging file instead of the current outfile.
(Default) Oracle OLAP does not send the text of model equations and results to a file while a model executes.
MODTRACE sends the equations of a model to the current outfile in the order in which they are being solved. Before you run the model, you might want to use the MODEL.COMPRPT program to get a preview of the solution order. A preview can be especially helpful when the model is large and complex. The MODEL.COMPRPT
program, which you can run after compiling a model, produces a report that shows how the compiler has organized the model equations into blocks and the order in which the blocks and equations are solved.
Understanding Trace Information
MODTRACE shows the name of the current model on each line of the trace. The trace includes the following types of lines.
Block. A block line gives the block number and block type of the block that is about to be executed. The type of block can be simple, step-forward, step-backward, or simultaneous. For a step-forward or step-backward block, the block line specifies the dimension being stepped over. For a simultaneous block with a cross-dimensional dependency, the block line specifies the dimensions involved in the dependency. See MODEL command for information on blocks in a model.
Iteration. These lines occur in simultaneous blocks and specify the number of the iteration that is about to be performed for the current block. When you are using the Aitkens solution method, the next-guess iterations are identified. (The MODSIMULTYPE option determines the solution method being used.)
Equation. The equation that is about to be calculated.
Results. A results line follows each equation line and shows the results assigned by the equation. It shows the variable to which the results were assigned and the current value of each model dimension. In a simultaneous block, it also shows the current iteration number. For example, when actual
is the solution variable and the model dimensions are line
and month
, a results line in a simultaneous block might look like the following one.
(MOD= INCOME.CALC) ACTUAL (LINE OPR.INCOME MONTH 'JAN96' ITER 1) = 108.9600000
Using MODTRACE with Dimension-Based Equations
When you run a model that contains dimension-based equations, Oracle OLAP automatically loops over all the dimensions of the solution variable. In the trace, the results lines show the current value of each dimension listed in a DIMENSION statement, but they do not show the current values of extra dimensions that are not listed in DIMENSION statement. See DIMENSION (in models) for more information about using DIMENSION statements.
Thus, when the model dimensions are line
and month
, and when the solution variable is dimensioned by line
, month
, and division
, the current value of division
is not shown in the results lines. Oracle OLAP executes the entire model for the first value in the status of division
, then for the second value in the status, and so on.
When you run a model that assigns values to variables, Oracle OLAP automatically loops over all the dimensions (or bases of a composite) of those variables. In this case, the current value of each of the variable's dimensions is shown in the trace.
Example 5-63 Debugging a Model with MODTRACE
The following statements define a model named income.budget
.
DEFINE income.budget MODEL LD Model for estimating budget items MODEL DIMENSION line month Opr.Income = Gross.Margin - Marketing Gross.Margin = Revenue - Cogs Revenue = LAG(Revenue, 1, month) * 1.02 Cogs = LAG(Cogs, 1, month) * 1.01 Marketing = LAG(Opr.Income, 1, month) * 0.20 END
This model estimates budget line items on an income statement. The model equations are based on a line
dimension. The following statements compile the model and run the MODEL.COMPRPT program.
COMPILE income.budget MODEL.COMPRPT income.budget
The MODEL.COMPRPT
statement produces the following compilation report.
MODEL INCOME.BUDGET <LINE MONTH> BLOCK 1 (SIMPLE) INCOME.BUDGET 4: revenue = lag(revenue, 1, month) * 1.02 INCOME.BUDGET 5: cogs = lag(cogs, 1, month) * 1.01 INCOME.BUDGET 3: gross.margin = revenue - cogs BLOCK 2 (STEP-FORWARD <MONTH>) INCOME.BUDGET 6: marketing = lag(opr.income, 1, month) * 0.20 INCOME.BUDGET 2: opr.income = gross.margin - marketing END BLOCK 2 END BLOCK 1
When you want to debug this model, you can trace its execution, line by line, by turning on MODTRACE before running the model.
The following statements limit dimensions, specify tracing, and run the model.
LIMIT month TO 'Jan97' TO 'Mar97' LIMIT division TO 'Camping' MODTRACE = YES income.budget budget
These statements produce the following line-by-line results.
(MOD= INCOME.BUDGET) BLOCK 1: SIMPLE (MOD= INCOME.BUDGET) revenue = lag(revenue, 1, month) * 1.02 (MOD= INCOME.BUDGET) BUDGET (LINE REVENUE MONTH 'JAN97') = 744491.1966 (MOD= INCOME.BUDGET) BUDGET (LINE REVENUE MONTH 'FEB97') = 759381.020532 (MOD= INCOME.BUDGET) BUDGET (LINE REVENUE MONTH 'MAR97') = 774568.64094264 (MOD= INCOME.BUDGET) cogs = lag(cogs, 1, month) * 1.01 (MOD= INCOME.BUDGET) BUDGET (LINE COGS MONTH 'JAN97') = 382386.2323 (MOD= INCOME.BUDGET) BUDGET (LINE COGS MONTH 'FEB97') = 386210.094623 (MOD= INCOME.BUDGET) BUDGET (LINE COGS MONTH 'MAR97') = 390072.19556923 (MOD= INCOME.BUDGET) gross.margin = revenue - cogs (MOD= INCOME.BUDGET) BUDGET (LINE GROSS.MARGIN MONTH 'JAN97') = 362104.9643 (MOD= INCOME.BUDGET) BUDGET (LINE GROSS.MARGIN MONTH 'FEB97') = 373170.925909 (MOD= INCOME.BUDGET) BUDGET (LINE GROSS.MARGIN MONTH 'MAR97') = 384496.44537341 (MOD= INCOME.BUDGET) BLOCK 2 STEP-FORWARD <MONTH> (MOD= INCOME.BUDGET) marketing = lag(opr.income, 1, month) * 0.20 (MOD= INCOME.BUDGET) BUDGET (LINE MARKETING MONTH 'JAN97') = 39938.192 (MOD= INCOME.BUDGET) opr.income = gross.margin - marketing (MOD= INCOME.BUDGET) BUDGET (LINE OPR.INCOME MONTH 'JAN97') = 322166.7723 (MOD= INCOME.BUDGET) marketing = lag(opr.income, 1, month) * 0.20 (MOD= INCOME.BUDGET) BUDGET (LINE MARKETING MONTH 'FEB97') = 64433.35446 (MOD= INCOME.BUDGET) opr.income = gross.margin - marketing (MOD= INCOME.BUDGET) BUDGET (LINE OPR.INCOME MONTH 'FEB97') = 308737.571449 (MOD= INCOME.BUDGET) marketing = lag(opr.income, 1, month) * 0.20 (MOD= INCOME.BUDGET) BUDGET (LINE MARKETING MONTH 'MAR97') = 61747.5142898 (MOD= INCOME.BUDGET) opr.income = gross.margin - marketing (MOD= INCOME.BUDGET) BUDGET (LINE OPR.INCOME MONTH 'MAR97') = 322748.93108361 (MOD= INCOME.BUDGET) END BLOCK 2 (MOD= INCOME.BUDGET) END BLOCK 1
In Block 1, which is a simple block, Oracle OLAP solved the equations one at a time, looping over the three values in the status of month
as it solved each equation. In Block 2, which is a step-forward block over the month
dimension, Oracle OLAP stepped over the values in the status of month
, solving all the equations in the block for each month in turn.