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: 7251

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: 7251

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 SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts DB2 Streaming Batch Processing Problem Manshadi DB2 4 Sat Sep 24, 2016 12:14 pm
No new posts Easytrieve - Report writing - Only 1 ... Abhi Nature CA Products 2 Wed Sep 14, 2016 11:40 am


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