Stack Code Calculator Function

The Stack Code Calculator function is used by the BTREE processor to update routines in order to build key strings based on the contents of an item, along with a key equation that is part of the file key structure. This equation calculator routine is also available from within mvBase so that your programs can compute keys based upon the same equations that BTREE uses.

Format

CALC(equation,id,data,mv.al.cnt)

Parameter(s)

equation

Stack-code equation whose format is described below.

id

Item-ID (attribute 0) that is used to formulate the answer.

data

Rest of the item (as a Dynamic Array) that is used to formulate the answer.

mv.al.cnt

MultiValue count (or 1 if MultiValues are not being used) that specifies which MultiValue is to be extracted with MultiValue attributes.

This function returns a single string that is the result of the calculation. If an error is encountered in the equation, a NULL string is returned.

The format of the equation is similar to ACCESS F-codes with elements separated by subvalue marks CHAR(252). These elements are usable as elements within stack equations:

Parameter

Description

A##

Extracts specified attribute (value 1).

A##.##

Extracts specified value within specified attribute.

M##

Extracts val.cnt within specified attribute.

C....

Constant.

I....

ICONV function.

L##

Left-justifies in specified number of spaces.

M##

Extracts mv.al.ctr within specified attribute.

O....

OCONV function.

R##

Right-justifies in specified number of spaces.

U

Make the top of the stack Uppercase.

Z

Extracts the current MultiValue counter.

:

Concatenates elements.

See Also

Using the BTREE File Structure System

BTREE File Structure

Interfacing with Applications

Defining Key Structures

Using Lookup and Browse Routines

Source Code to Lookup Routines

Maintaining Key File Performance

Optimizing Keys

Sizing Key Files

Estimating a Key's Location and File Size

Rebuilding Keys

Key Storage Requirements