View previous topic :: View next topic
|
Author |
Message |
iliganon
New User
Joined: 09 Jun 2010 Posts: 4 Location: Philippines
|
|
|
|
Hello!
I'm having this problem on Easytrieve Plus (6.3), where I'm using the BEFORE-BREAK procedure.
After the LINE statement, I have these two procedures:
Code: |
BEFORE-LINE. PROC
REC-COUNT = REC-COUNT + 1
TOTAL-AMOUNT = TOTAL-AMOUNT + ACCM-AMOUNT
END-PROC
BEFORE-BREAK. PROC
DISPLAY ' '
DISPLAY ' '
DISPLAY ' TOTALS FOR ' ACCM-ACCT
DISPLAY ' ' +
'TOTAL COUNT' ' ' 'TOTAL AMOUNT'
DISPLAY ' NEGOTIATED CHECKS : ' +
REC-COUNT ' ' TOTAL-AMOUNT
MOVE ZEROES TO REC-COUNT
MOVE ZEROES TO TOTAL-AMOUNT
END-PROC
|
The report goes smoothly for every CONTROL but for the last page, the BEFORE-BREAK procedure is printed twice:
Code: |
TOTALS FOR 2186900076
TOTAL COUNT TOTAL AMOUNT
NEGOTIATED CHECKS : 10 5,050,000.25
TOTALS FOR 2186900076
TOTAL COUNT TOTAL AMOUNT
NEGOTIATED CHECKS : 0 .00
|
I also used this: CONTROL FINAL NOPRINT ACCM-ACCT NOPRINT NEWPAGE
Is there a way I can remove the last BEFORE-BREAK totals?
Thank you. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You have two levels of break, because you specify FINAL. If you want to keep the FINAL, the you have to test the "level" for your before break procedure.
How are these defned, REC-COUNT, TOTAL-AMOUNT, out of interest? W or S?
Why are you using something called REC-COUNT for printing something which is the number of negotiated checks? Can't you come up with something more meaningful and less confusing? Same for total amount. Doesn't cost you much to type a bit more, but could save someone hours in the future when they are maintaining/supporting your program. Might even be you. |
|
Back to top |
|
|
iliganon
New User
Joined: 09 Jun 2010 Posts: 4 Location: Philippines
|
|
|
|
I have fixed this already. My bad... Sorry folks...
REC-COUNT and TOTAL-AMOUNT are defined as W.
Here's my solution to the problem:
Code: |
BEFORE-BREAK. PROC
IF LEVEL = 1
DISPLAY ' '
DISPLAY ' '
DISPLAY ' TOTALS FOR ' ACCM-ACCT
DISPLAY ' ' +
'TOTAL COUNT' ' ' 'TOTAL AMOUNT'
DISPLAY ' NEGOTIATED CHECKS : ' +
REC-COUNT ' ' TOTAL-AMOUNT
END-IF
MOVE ZEROES TO REC-COUNT
MOVE ZEROES TO TOTAL-AMOUNT
END-PROC
|
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
OK. Any fields which you amend in a report procedure I would recommend you define as "S". If you continue to use W's, you will one day cause yourself a problem, more than just including any extra fields on Easytrieve's report file.
I therefore prefix all my datanames with W- or S-, so it is clear. And, as I do everywhere, I make the datanames as meaningful as possible.
As someone put it recently, you are not writing the program for yourself, but for those who end up maintaining/supporting it.
Looking a little more at your code, you are not doing any selection to do your totals. Have a look at the SUM, as you can then probably get away from your own counts/totals anyway, in this instance.
Do you have any Easytrieve macros to help you along? I used to have one called %INC. So, for a count, %INC W-WITH-A-LONG-NAME-THAT-DESCRIBES and it generates the a = a + 1. %INC W-A BY 2, adds two.
Similar with %TOT. %TOT W-A BY W-B. |
|
Back to top |
|
|
|