IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Easytrieve problem: BEFORE-BREAK prints twice on last page


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
iliganon

New User


Joined: 09 Jun 2010
Posts: 4
Location: Philippines

PostPosted: Tue Apr 26, 2011 6:40 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 26, 2011 12:02 pm
Reply with quote

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
View user's profile Send private message
iliganon

New User


Joined: 09 Jun 2010
Posts: 4
Location: Philippines

PostPosted: Tue Apr 26, 2011 12:33 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 26, 2011 5:03 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Abend S0C4 11 (Page Translation Excep... PL/I & Assembler 16
No new posts z/vm installation problem All Other Mainframe Topics 0
No new posts Count the number of characters in a f... CA Products 1
No new posts File matching functionality in Easytr... DFSORT/ICETOOL 14
Search our Forums:

Back to Top