How can I get totals on a report every time there is a break? Do I need a Before-Break Proc coded?

Document ID : KB000012755
Last Modified Date : 14/02/2018
Show Technical Document Details
Question:

How can I get totals on a report every time there is a break?  Do I need to code a Before-Break Proc?

Answer:

Use TALLY on the LINE statement.

Also, please ensure that TALLYSIZE parameter on the REPORT statement is specified with a large enough number to allow the final line totals to print the totals correctly as well.  

No Before-Break Proc needs to be coded for this functionality to get a count of totals when a break occurs.

Additional Information:

https://docops.ca.com/ca-easytrieve/11-6/en/programming/report-processing/control-reports#CONTROLReports-TALLY has the following information:

TALLY is a system-defined field for control reports. TALLY contains the number of detail records that comprise a control break. You can use TALLY on a LINE statement or you can use it in calculations within report procedures. TALLY is commonly used to determine averages for a control break.

TALLY is a 10-byte packed decimal field with zero decimal places. This definition is used for calculations contained within report procedures. REPORT TALLYSIZE defines the number of digits that are printed for TALLY. A TALLY accumulator is created for each control break level.

https://docops.ca.com/ca-easytrieve/11-6/en/language-reference/statements-n-r/report-statement has further information on the TALLYSIZE parameter on the REPORT statement:

  • Use TALLYSIZE to set the print size for the field TALLY. Valid values for tally-print-size are 1 to 18. The number of digits used for TALLY on a summary line is the sum of the values of TALLYSIZE and SUMSPACE.