(Area 4A)
This format of the COMPUTE command, used during report printing, functions in much the same manner as the COMPUTE command during record selection. The intention is to calculate a numeric result based on an arithmetic expression. The basic differences are the timing of the execution of the calculation and the types of numeric fields that can be processed.
Since the system performs the calculations during the printing of the report, this format of the command can only appear within the report definition group. In addition, the computation performed pertains only to the particular report in which it is coded.
Calculations can be specified to be performed at detail time, total time, or both. When performing calculations at detail time, input to the expression can be from the GSA and from the Hit File. When performing calculations at total time, input can also be made from the field accumulators. This facility allows calculations to be made on the accumulated values of specific fields.
The format of the COMPUTE during report printing command is:
►►─ COMPUTE ─┬─ (D) ──┬─┬─ result ────────┬─ =arithmetic-expression ──────────► ├─ (T) ──┤ └─ result(n1.n2) ─┘ └─ (DT) ─┘ ►─┬────────────────────────────────────────┬─┬─────────┬─────────────────────►◄ └─┬─ HEADING ─┬─ ' heading1 ''heading2' ─┘ └─ ROUND ─┘ └─ HDG ─────┘
Specifies that the computation is to be performed at detail time during printing of the report.
Specifies that the computation is to be performed at total time, that is, when a control break occurs.
Specifies that the computation is to be performed at both detail time and total time.
Specifies the name given a predefined numeric field in which the result of the computation is placed. The field name should be defined as packed decimal only.
Specifies a user-supplied field name, coded in accordance with standard conventions, in which the result of the computation is to be placed. Use of this parameter implicitly defines the field to contain the result without predefining the field.
When the precision clause (n1.n2) does not follow the field name specification, the Reporting Facility automatically calculates the precision of the result based on the individual components of the arithmetic expression.
When coded, n1 and n2 indicate that the field is to contain n1 integers and n2 decimals, respectively. The value of n1+n2 must be greater than 0 and must not exceed 15. If you accumulate this field, the value must not exceed 15 or truncation will occur. When the field contains no integers, n1 must be 0. When no decimals are necessary, n2 must be 0.
Specifies the arithmetic operations to be performed. The terms involved in the expression can be either numeric fields or constants, connected with arithmetic operators.
Specifies an optional separator used to denote that the literals to follow are to be interpreted as headings. Heading specifications are valid only when the result field of the computation is being implicitly defined. HDG can be used in place of HEADING in the command.
Enables you to assign one or two lines of heading to the result field when the field is implicitly defined in the COMPUTE command. The lines of heading appear as column headings if the field is printed in a report. If the parameter is omitted and the result field is implicitly defined, the Reporting Facility automatically assigns the field name as heading line 1, with no second line of heading.
Optionally defines whether the result will be rounded before being placed into the result field. For rounding to occur, the computed value must have more decimal places than the result field. The default is not to round.
Note the following:
The system stabilizes the GSA at the end of the record selection phase. You can reference or modify the GSA by this type of command only after you perform the sort.
Example
COMPUTE(D) RESULT-FIELD EQ INPUT-FIELD * &100 ROUND 'HEADING1' COMPUTE(T) RESULT-FIELD EQ (INPUT-FIELD) * &100 COMPUTE(DT) AVERAGE(7.2) EQ (((HOURS) / (CONTACTS)) + &.005) ROUND
|
Copyright © 2014 CA.
All rights reserved.
|
|