SUBTOTAL

Describe a subtotal access field

SUBTOTAL name TOTALFIELD totalfield BREAKFIELD breakfield 
TOTALTYPE type [DESCRIPTION "description"]

name

The name of the temporary subtotal access field. It can have up to 15 characters and cannot contain spaces.

TOTALFIELD totalfield

The field on which to total. Totalfield must be one of the following:

field_spec (no subscript or range)

A specification for a field in a report. The data type for this field must be numeric. See Field_spec definition.

<COUNT>

Designates that the subtotal access field should contain the record count.

BREAKFIELD breakfield

The sort level on which to total. Breakfield must be one of the following:

field_spec (no subscript or range)

A specification for a field in a report. This field must be a previously defined sort field with an associated line or page break. See Field_spec definition.

<REPORT>

Designates that the subtotal access field should contain a total for the entire report.

TOTALTYPE type

The type of total for a report. Valid values are COMPLETE (the total for the specified break level) and RUNNING (the current cumulative total for the given field at the specified level).

DESCRIPTION “description”

(optional) A description of the subtotal access field. It can have up to 40 characters.

The SUBTOTAL statement describes a temporary subtotal access field to be created in a report.

Subtotal access fields give access to a field’s total at any sort level. They are temporary fields that are not found in the repository. To create a field of this type, you must specify the field name, total field, break field, and total type. The maximum number of subtotal access fields that can be defined in a report is 99.

If your temporary subtotal access field does not have a unique name, it must be preceded by “TEMP.” For example, if your temporary field is called NUMBER and one of the selected files also contains a field called NUMBER, you would specify the temporary field like this:

TEMP.NUMBER
SUBTOTAL NUMRECS TOTALFIELD <COUNT> BREAKFIELD <REPORT> 
TOTALTYPE COMPLETE
SUBTOTAL INCOME TOTALFIELD ITEMCOST 
BREAKFIELD CUST_ID TOTALTYPE RUNNING