Oracle9i OLAP Services Developer's Guide to the OLAP DML
Release 1 (9.0.1)

Part Number A86720-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

Debugging Programs, 6 of 6


Working with watch points

Setting a watch point using the WATCH command

If you do not want to trace the execution of a program from its beginning, then you can select a point in the program where you want to start tracing. You use the WATCH command to select a watch point. You can enter a WATCH command in the command input window in OLAP Worksheet.

The WATCH command sets a watch point as a Boolean expression that is monitored by the debugging environment. When the Boolean expression becomes true, the debugging environment suspends execution of the program and displays the double-line arrow prompt in the output pane of the command input window in OLAP Worksheet, from which you can examine the subsequent execution of the program.

To set a watch point, you specify the Boolean expression to be monitored, and, optionally, the name of a program in which to watch the expression. The Boolean expression can be something integral to your program, or you can include a watch point in the program just for debugging.

Example: Watching a Boolean expression that is integral to your program

In the sample program called QUARTER.RPT, a command limits the QUARTER dimension. You can use the results of that LIMIT command as a watch point as outlined below.

  1. Because you do not want to trace execution of QUARTER.RPT from the beginning, remove it from the trace list.

    Example:

    trace quarter.rpt off
    
  2. Set your watch point.

    Example:

    watch for statlen(quarter) eq 1 in quarter.rpt
    watch list
     1: Watch For STATLEN(QUARTER) EQ 1 within QUARTER.RPT ENABLED
    

    Note: The WATCH LIST command displays a list of the current watch points in the output pane in the command input window. When you set a watch point, it is assigned a watch number and is automatically enabled as indicated by the word ENABLED at the right end of the output line in the above example.

  3. Run QUARTER.RPT. It executes until the status of QUARTER is limited to one value. Then the debugging environment suspends program execution and displays the double-line arrow prompt. You can step through the rest of the program or execute other OLAP DML commands in the command input window.

Enabling and disabling a watch point

Once a watch point expression is TRUE, the debugging environment disables it.

watch list
 1:Watch For STATLEN(QUARTER) EQ 1 within QUARTER.RPT DISABLED

You can enable it again with another WATCH command that specifies the watch number.

watch enable 1

Using a special debugging watch point

Instead of using an integral part of the program as a watch point, you can set up a special watch point specifically for the purpose of debugging.

Suppose you declare a local variable called WPOINT at the start of QUARTER.RPT and then set WPOINT to 1 at the point in the program where you want to start examining its execution. You can also set WPOINT to other values in other parts of your program to establish several watch points for different purposes.

describe quarter.rpt
DEFINE QUARTER.RPT PROGRAM
PROGRAM
argument userchoice month
variable wpoint integer      "Define watch point
trap on finish
pushlevel 'quarter'
push decimals month quarter
limit month to userchoice
wpoint = 1                   "Set watch point
limit quarter to month
report down district across product: -
   heading 'Total Sales' -
   total(sales, district product quarter)
finish:
poplevel 'quarter'
END

If you now set a watch point as follows and run QUARTER.RPT, then the debugger suspends execution at the point where WPOINT is set to 1 and displays the double-line arrow prompt.

watch for wpoint eq 1 in quarter.rpt
quarter.rpt

Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback