Previous Page | Next Page

The COMPUTAB Procedure

Controlling Execution within Row and Column Blocks

Row names, column names, and the special variables _ROW_ and _COL_ can be used to limit the execution of programming statements to selected rows or columns. A row block operates on all columns of the table for a specified row unless restricted in some way. Likewise, a column block operates on all rows for a specified column. Use column names or _COL_ in a row block to execute programming statements conditionally; use row names or _ROW_ in a column block.

For example, consider a simple column block that consists of only one statement:

   col: total = qtr1 + qtr2 + qtr3 + qtr4;

This column block assigns a value to each row in the TOTAL column. As each row participates in the execution of a column block, the following changes occur:

  • Its row variable in the program data vector is set to 1.

  • The value of _ROW_ is the number of the participating row.

  • The value from each column of the row is copied from the COMPUTAB data table to the program data vector.

To avoid calculating TOTAL on particular rows, use row names or _ROW_. For example,

   col: if sales|cost then total = qtr1 + qtr2 + qtr3 + qtr4;


   col: if _row_ < 3  then total = qtr1 + qtr2 + qtr3 + qtr4;

Row and column blocks can appear in any order, and rows and columns can be selected in each block.

Previous Page | Next Page | Top of Page