The SUM control statement allows you to sum numeric fields in records with equal sort/merge keys, place the sum in one record which is retained, and delete the other equally-keyed records. Provided arithmetic overflow does not occur during the summing process, the SUM control statement produces only one record per sort/merge key. The records deleted by SUM can optionally be written to a separate output file.
SUM FIELDS=NONE can be used to delete all but one of the records with equal keys without doing any summing.
SUM can also be specified on the DUPKEYS control statement to perform the same function. The DUPKEYS statement provides additional functions for equally-keyed records such as providing AVG, MAX and MIN values.
The SUM control statement should not be used and will be ignored when FIELDS=COPY is specified on the SORT or MERGE control statement.