Performing Inter-Row Calculations

How to:


The RECAP command enables you to perform calculations on data in the rows of the report to produce new rows. You must supply the name and format of the value that results from the calculation, and an expression that defines the calculation you wish to perform. Since RECAP calculations are performed among rows, each row in the calculation must be uniquely identified. FML supplies default row labels for this purpose (R1, R2, and so on). However, you may assign more meaningful labels. For more information, see Referring to Rows in Calculations.

Syntax: How to Define Inter-Row Calculations

RECAP calcname[/format]=expression; [AS 'text']



Is the required command name. It should begin on a line by itself.


Is the name you assign to the calculated value. The name can be up to 66 characters long, and must start with an alphabetic character. This name also serves as an explicit label. For more information, see Referring to Rows in Calculations.


Is the USAGE format of the calculated value. It cannot exceed the column width. The default is the format of the column in which the calculated value is displayed.


Can be any calculation available with the DEFINE command (including IF ... THEN ... ELSE syntax, functions, excluding DECODE and EDIT, and fields in date format). The expression may extend to as many lines as it requires. A semicolon is required at the end of the expression. For more information, see Using Functions in RECAP Calculations and the Using Functions manual.

The expression can include references to specific rows using the default FML positional labels (R1, R2, and so on), or it can refer to rows, columns, and cells using a variety of flexible notation techniques. Note that Rn references can only be used for rows previously evaluated within the model. For more information, see Referring to Rows in Calculations, Referring to Columns in Calculations, and Referring to Cells in Calculations.

AS 'text'

Changes the default title of the row. By default, the name of the RECAP value is displayed as the row title in output. The AS phrase replaces the default. Enclose the text in single quotation marks.

Reference: Usage Notes for RECAP

  • RECAP expressions refer to other rows in the model by their labels (either explicit or default). Labels referred to in a RECAP expression must also be specified in the report request.
  • The format specified for the RECAP result overrides the format of the column. In the following example,

    TOTVAL/D6.2S displays the result as six positions with two decimal places (and displays blanks if the value was zero) in each column of the report, regardless of the format of the data in the column. This feature can be used to display percentages in a column of whole numbers.

  • Subtotals are not supported in FML.
  • In environments that support the RETYPE command, note that RETYPE does not recognize labels in FML with field format redefinition.
  • Rn references (default positional row labels) can only be used for rows previously evaluated within the model.