I assume you want to perform calculations on subtotal values (defined or otherwise). If this assumption is correct then a RECAP or COMPUTE that is associated with a by field is what you need (this happens in the internal matrix after the defines have been evaluated and the records are selected and sorted - you wanted to know where this was done). Below is more information and examples I got out of the manual about recap and compute. Good luck!!
RECAP and COMPUTE
You can use the RECAP and COMPUTE commands to create subtotal values in a
calculation. The subtotal values are not displayed;
only the result of the calculation is
shown on the report.
A BY or ON phrase is required to initialize the syntax.
Syntax How to Use Subtotals in Calculations
Both the RECAP and COMPUTE commands have similar syntax to other total and
subtotal commands.
{BY|ON} fieldname1 {RECAP|COMPUTE} fieldname2[/format] = expression;
[WHEN expression;]
where:
fieldname1
Is the field in the BY phrase. Each time the BY field changes value, a new recap
value is calculated.
fieldname2
Is the field name that contains the result of the expression.
/format
Can be any valid format. The default is D12.2.
expression
Can be any valid expression, described in Chapter 8, Using Expressions. You must
end the expression with a semicolon.
WHEN expression
Is for use with RECAP only. Specifies the conditional display of RECAP lines as
determined by a Boolean expression (see Conditionally Displaying Summary Lines
and Text on page 7-22). You must end the expression with a semicolon.
Reference Usage Notes for RECAP and COMPUTE
• RECAP uses the current value of the named sort field, the current subtotal values of
any computational fields that appear as display fields, or the last value for
alphanumeric fields.
• The field names in the expression must be fields that appear on the report. That is,
they must be display fields, or sort control fields.
• Each RECAP value displays on a separate line. However, if the request contains a
RECAP command and SUBFOOT text, the RECAP value displays only in the
SUBFOOT text and must be specified in the text using a spot marker. (For details see
Chapter 9, Customizing Tabular Reports.)
• The calculations in a RECAP or COMPUTE can appear anywhere under the control
break along with any text. (For details see Chapter 9, Customizing Tabular Reports.)
• The word RECAP may not be specified more than seven times. However, more than
seven RECAP calculations are permitted. Use the following syntax:
ON fieldname RECAP field1/format= ... ;
field2/format= ... ;
.
.
.
Example Using RECAP
The following request illustrates the use of a RECAP (DEPT_NET) to determine net
earnings for each department:
TABLE FILE EMPLOYEE
SUM DED_AMT AND GROSS
BY DEPARTMENT BY PAY_DATE
ON DEPARTMENT RECAP DEPT_NET/D8.2M = GROSS-DED_AMT;
WHEN PAY_DATE GT 820101
END
The output is:
Example Using Multiple RECAP Commands
You can include multiple RECAP or COMPUTE commands in a request. This option
enables you to perform different calculations at different control breaks.
The following request illustrates the use of multiple RECAP commands:
TABLE FILE SALES
SUM UNIT_SOLD AND RETURNS
BY DATE BY AREA BY PROD_CODE
ON DATE RECAP
DATE_RATIO=RETURNS/UNIT_SOLD;
ON AREA UNDER-LINE RECAP
AREA_RATIO=RETURNS/UNIT_SOLD;
END
FOCUS 7.6 MVS PDF,HTML,EXCEL