Syntax
<routine_call> := routine variable GIVING variable
Parameters
routine
The statistical routine to invoke, as listed below.
variable
The source variable used by the statistical routine as the basis of its computation.
GIVING variable
GIVING can be abbreviated as GIV. Directs the result of the computation to the specified variable.
Description
The routine call command parameter can be specified as part of the OnChange logic command, in order to invoke a statistical routine in the Main method of a report.
Calculations involve the value of the source variable at each iteration of the loop containing the OnChange logic command.
The result of the statistical routine calculation is stored in a number-primitive variable, and can be accessed by the report footer. This variable is usually included in the frame. If this variable is not included in the frame, set it to zero or spaces in the logic of the frame method.
The following table lists available statistical routines and their abbreviations.
Routine | Abbreviation | Description |
---|---|---|
Count | CNT | Number of values (which is also the number of iterations) |
Maximum | MAX | Largest value |
Minimum | MIN | Smallest value |
Sum | SUM | Sum of the values |
SumSquares | SSQ | Sum of the squares of the values |
Average | AVG (or) MEAN | Average of the values |
MeanSquares | MSQ | Average of the squares of the values |
Variance | VAR | Variance of the values |
StdDeviation | STD | Standard deviation of the values |
When using these statistical routines, internal working storage variables are generated in the report where necessary, to store intermediate values for some of the calculations.
Note: For multiple OnChange logic command loops, ensure working storage variables are unique to the loop where they are used, or initialized at the beginning of the loop.
These variables are of a fixed size. If the magnitude of the data used when running the report exceeds this size, runtime calculation errors can occur. The internal variable number and usage are shown in the following table.
Name | Routine | Used to store the... |
---|---|---|
Maximum | 1 | Largest value |
Minimum | 2 | Smallest value |
Variance | 3 | Sum of the squares of the data |
| 4 | Sum of the data |
| 5 | Count of the data items |
StdDeviation | 6 | Sum of the squares of the data |
| 7 | Sum of the data |
| 8 | Count of the data items |
Average | 9 | Count of the data items |
MeanSquares | 10 | Count of the data items |
The internal variable numbers listed in the above table and the variable size for each host are shown in the following table.
Routine | MCP COBOL Definition |
---|---|
1 | PIC 9(12)V9(6) |
2 | PIC 9(12)V9(6) |
3 | PIC 9(14)V9(9) |
4 | PIC 9(12)V9(6) |
5 | PIC 9(10) |
6 | PIC 9(14)V9(9) |
7 | PIC 9(12)V9(6) |
8 | PIC 9(10) |
9 | PIC 9(10) |
10 | PIC 9(10) |