# AGGREGATETYPE attribute

The `AGGREGATETYPE`

attribute defines how
the aggregate field value is computed.

## Syntax

`AGGREGATETYPE = `__{__ PROGRAM __|__ SUM __|__ AVG __|__ MIN __|__ MAX __|__ COUNT __}__

## Usage

`PROGRAM`

specifies
that the aggregate value will be computed and displayed by the program
code.

An aggregate type different from `PROGRAM`

specifies
that the aggregate value is computed automatically:

`SUM`

computes the total of all values of the corresponding numeric column.`AVG`

computes the average of all values of the corresponding numeric column.`MIN`

displays the minimum value of the corresponding numeric column.`MAX`

displays the maximum value of the corresponding numeric column.`COUNT`

computes the number of rows.

The `SUM`

and `AVG`

aggregate
types apply to data types that can be used as operand for an addition,
such as `INTEGER`

, `DECIMAL`

, ` INTERVAL`

.

The `MIN`

and `MAX`

aggregate
types apply to data types that can be compared, such as `INTEGER`

, `DECIMAL`

, `INTERVAL`

,
`CHAR`

,` DATETIME`

.

For more details, see Summary lines in tables.

## Example

`AGGREGATE tot = FORMONLY.total, AGGREGATETYPE=PROGRAM;`