SUM Command

The SUM command totals the data elements in a numeric attribute.

Format

SUM [DICT] filename [item-list] [attribute-name] [selection] [modifiers] [(options)]

Parameter(s)

DICT

Specifies the file dictionary.

filename

Name of the file.

item-list

List of individual item-IDs. Enclose each item-ID in single quotes.

attribute-name

Attribute that you want to sum. Refer to this attribute by its item-ID, as defined in the file dictionary.

selection

Specifies one or more conditions that an item must meet to be included in the total. For a complete description of selection expression syntax, see the LIST Command.

modifiers

Include one or more keywords that specify the report format. These parameters affect headers, footers, spacing, totalling column figures, control breaks, and more. For complete information about using these keywords, see the section, Connectives, Modifiers, and Options in the INFO/ACCESS User Reference Guide.

options

Include one or more single-character codes that specify the report format and direct or modify output. They must be enclosed in parentheses, can be entered in any order, and need not be separated by spaces or any delimiters such as commas. For complete information about using these parenthetical options, see the section, Connectives, Modifiers, and Options in the INFO/ACCESS User Reference Guide.

Producing a Total for a Numeric Attribute

The following example totals the values for attribute AMOUNT in the ORDERS file:

>SUM ORDERS AMOUNT

TOTAL OF AMOUNT = $324,567.89

The next example totals the values for AMOUNT for all orders placed by LEARY:

>SUM ORDERS AMOUNT WITH LAST-NAME "LEARY"

TOTAL OF AMOUNT = $574.00

>