# XFOOT (Summing the Elements of an Array)

Free-Form Syntax |
(not allowed - use the %XFOOT built-in function) |

Code |
Factor 1 |
Factor 2 |
Result Field |
Indicators |
||
---|---|---|---|---|---|---|

XFOOT (H) |
Array name |
Sum |
+ | - | Z |

XFOOT adds the elements of an array together and places the sum into the field specified as the result field. Factor 2 contains the name of the array.

If half-adjust is specified, the rounding occurs after all elements are summed and before the results are moved into the result field. If the result field is an element of the array specified in factor 2, the value of the element before the XFOOT operation is used to calculate the total of the array.

If the array is float, XFOOT will be performed as follows: When the array is in descending sequence, the elements will be added together in reverse order. Otherwise, the elements will be added together starting with the first elements of the array.

For further rules for the XFOOT operation, see Arithmetic Operations or Array Operations.

See Figure 1 for an example of the XFOOT operation.