There are three ways to include calculated values in a QMF report:
The first method of including calculations in a report is handled by the database, and the other two are handled by QMF from specifications made on the form. When calculations are specified on the form, they are evaluated using REXX.
QMF verifies conditions, column definitions, and expressions whenever a form is loaded, imported, displayed, or run with a query. When you modify a condition, column definition, or expression, QMF verifies it again. This can result in a REXX error if QMF passes unexpected data during verification. To avoid this kind of REXX error, include your calculation, along with validation statements, in a REXX exec.
When using FORM.CONDITIONS or Column Definition, make sure the expression or exec returns the same value if invoked multiple times with the same parameters. If the exec does not return the same value, breaks might not resolve as expected, and summary values might not match printed results.
There can be a significant difference in performance, capability, and flexibility of calculations performed by the database and those evaluated using REXX. A REXX program can return values dependent upon complex logic or the values processed by REXX functions. Although REXX offers more function and programming options, there can be some drawbacks to relying on REXX for all of the calculations in a report.
REXX requires a certain amount of resource to evaluate expressions. If REXX is called repeatedly for completion of a report, you might notice an impact on performance. Because of this, you might choose to specify some calculations in the query. For example, to create a new column in a report based on the following:
((Column A - Column B) * 100) / Column B
you can enter the expression in SQL and rerun the query, or enter the expression as the definition for a new column in the form and display the report. Because the column defined in the form requires a call to REXX for every detail row processed for the report, you might decide to define the new column in the query.
[ Previous Page | Next Page | Contents | Index ]