Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Easytrieve problem: BEFORE-BREAK prints twice on last page

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
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    Post subject: Easytrieve problem: BEFORE-BREAK prints twice on last page
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Tue Apr 26, 2011 12:02 pm    Post subject: Reply to: Easytrieve problem: BEFORE-BREAK prints twice on l
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    Post subject: Re: Easytrieve problem: BEFORE-BREAK prints twice on last pa
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Tue Apr 26, 2011 5:03 pm    Post subject: Reply to: Easytrieve problem: BEFORE-BREAK prints twice on l
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    IBMMAINFRAMES.com Support Forums -> CA Products All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Strings with double quotes having pro... raja Arumugam All Other Mainframe Topics 11 Thu Mar 30, 2017 10:34 am
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts Easytrieve report shalem CA Products 4 Sun Feb 26, 2017 9:08 am
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us