Please enable JavaScript to view this site.
From version 6.2.57 - This program will allow you to accumulate up to 99 different totals for your PPD file. Each total (bucket) may have its own configuration such as the number of decimals to return, should the result be rounded and include comma delimiters. It works like the original COBTOTAL only now allowing for 99 different totals (buckets).
Note: In the description of the parameters below nn represents the bucket number. If this is left blank then bucket 01 is assumed.
Configure Totals
To configure the parameters for your total (bucket) you need to specify an *FIRST call. This should be called when you wish to define the requirements for your total and should only be called ONCE for each bucket, possibly inside a "Page = *FIRST" or "Page = *START" condition.
Note: If no *FIRST call is specified for a bucket the default values will be used.
Parameter |
In |
Len |
Out |
Len |
Comments |
PARM1 |
Number of output decimals (0 – 5) |
1 |
|
|
If left blank defaults to 0 |
PARM2 |
Round up result |
4 |
|
|
*YES to round or blank if not |
PARM3 |
Thousand delimiter etc. |
1 |
|
|
Enter delimiter if required e.g. “,” |
PARM4 |
Negative sign? |
4 |
|
|
*NO to stop minus sign on Total or Sub Total |
PARM5 |
Decimal point e.g. “.” or ”,” |
1 |
|
|
If left blank defaults to “.” This is required for Europe where decimal point is a comma. |
PARM6 |
*FIRSTnn |
8 |
|
|
Positions 1 - 6 = *FIRST Positions 7 - 8 = Bucket number e.g. 01, 02 |
Accumulate values
To add or subtract values from a bucket you would use either the *ADD or *SUB call where nn is the bucket number you wish to add / subtract the value to / from. The sub total for the bucket, after having processed the value, will be returned in PARM1.
Parameter |
In |
Len |
Out |
Len |
Comment |
PARM1 |
Value to sum |
30 |
Sub Total #3 |
20 #4 |
Sub total |
PARM2 |
|
*NEG |
4 |
If the sub total is negative |
|
PARM3 |
|
|
|||
PARM4 |
|
|
|||
PARM5 |
|
|
|||
PARM6 |
*ADDnn or *SUBnn |
6 |
|
Positions 1 - 4 = *ADD#1 or *SUB#2 Positions 5 - 6 = Bucket number e.g. 01, 02 |
Notes:
#1 | If using *ADD you may pass in a number with a minus sign and it will subtract the value. It does not matter if the value that you pass in PARM1 has more or less decimals than the decimals required for the total value. |
#2 | If you do not have minus signs on your spooled file then you may use *SUB to subtract a number from your total. It does not matter if the value that you pass in PARM1 has more or less decimals than the decimals required for the total value. If you use *SUB and pass in a number with a minus sign it will add the value. |
#3 | If there is an error in the value being passed in *ERROR will be returned in PARM1 otherwise a subtotal of all the values passed for this type of call since initialisation will be returned. |
#4 | This is the maximum length; the actual length will depend upon the number of decimals you wish returned, a minus sign and whether or not you have specified a thousands delimiter. |
Reset a total
To reset the total for a bucket you would use the *RESET call where nn is the bucket number you wish to reset. The sub total, before it is zeroed, will also be returned in PARM1.
Parameter |
In |
Len |
Out |
Len |
Comment |
PARM1 |
|
Sub Total |
20 #4 |
The sub total is returned and then zeroed. |
|
PARM2 |
|
*NEG |
4 |
If the sub total is negative |
|
PARM3 |
|
|
|||
PARM4 |
|
|
|||
PARM5 |
|
|
|||
PARM6 |
*RESETnn |
8 |
|
Positions 1 - 6 = *RESET Positions 7 - 8 = Bucket number e.g. 01, 02 |
End Accumulation process
This is an MANDATORY call and should be inside either a “Page = *LAST” or “Page = *END” condition and only called ONCE within a PPD file.
The bucket number is not required as this call will clear ALL totals regardless of the bucket number specified. If you do specify a bucket number, then the total for that bucket will be returned in PARM1.
If you wish to return totals for more than one bucket and clear it to start accumulating again then you should use the *RESET call.
Parameter |
In |
Len |
Out |
Len |
Comment |
PARM1 |
|
Total Value |
20 #4 |
Total for the bucket |
|
PARM2 |
|
*NEG |
4 |
If the total is negative |
|
PARM3 |
|
|
|||
PARM4 |
|
|
|||
PARM5 |
|
|
|||
PARM6 |
*LASTnn |
7 |
|
Positions 1 - 5 = *LAST Positions 6 - 7 = Optional Bucket number e.g. 01, 02 |