Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
not getting correct amounts after compute amounts?

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
babu_hi

New User


Joined: 11 Apr 2006
Posts: 93

PostPosted: Thu Jan 21, 2010 4:11 pm    Post subject: not getting correct amounts after compute amounts?
Reply with quote

have a input file and it is having 4 fields (Branch,User,Amount and Bin).Each branch may have different users and bins.My requirement is calculate the sum of the amount of each bramch,user,bin fields.please provide me the logic.

Input file Data :-

Branch User Amount Bin
20 UA01 1 5000 0
20 UA01 1 5000 0
20 UA01 1 5000 0
20 UA01 2 10000 10000
20 UA01 2 50000 50000
20 UA01 2 0 10000
20 UA01 3 0 50000
20 UA02 1 10000 0
20 UA02 1 1000 0
20 UA02 1 1500000 0
20 UA02 3 10000 0
610 SS01 1 10000 0
610 SS01 2 0 72400
610 SS01 2 0 13800
610 SS01 3 0 500
610 SS01 3 0 500
610 SS03 1 0 32474
610 SS03 1 10000 0
610 SS03 1 10000 0
610 SS03 2 0 12300
610 SS03 2 0 12000
610 SS03 3 1000 0
610 SS03 3 0 500
610 SS05 1 0 32474
610 SS05 1 0 32474
610 SS05 1 13000 0
610 SS05 2 0 10000
610 SS05 2 0 1200
610 SS05 3 10000 0
610 SS05 3 0 10000

I got out put like this,
Branch User Amount Bin
*************************** TOP OF DATA **
20 UA01 1 10000
20 UA01 2 110000
20 UA01 3 0
20 UA02 1 1501000
20 UA02 3 0
10 SS01 1 0
10 SS01 2 86200
10 SS01 3 1000
10 SS03 1 20000
10 SS03 2 24300
10 SS03 3 1500
10 SS05 1 45474
10 SS05 2 11200
10 SS05 3 0
************************** BOTTOM OF DATA

when i ran my code i am getting incorrect amounts.The amounts are not computed properly.please let me know the if any wrong in my code?

READ GAD-DETAIL-TRAN-FILE INTO WS-GAD-FILE-RECORD
MOVE SSTACB TO WS-SSTACB
MOVE SSCPWS TO WS-SSCPWS
MOVE SSBIN TO WS-SSBIN
MOVE SSCAM1 TO WS-SSCAM1
MOVE SSCHAM TO WS-SSCHAM

PERFORM UNTIL END-OF-FILE
READ GAD-DETAIL-TRAN-FILE

EVALUATE TRUE

WHEN FILE-IN-STATUS EQUAL TO ZEROS

ADD 1 TO WS-DETL-MATCH-CNT

IF SSTACB = WS-SSTACB
AND SSCPWS = WS-SSCPWS
AND SSBIN = WS-SSBIN
COMPUTE WS-AMT1 = SSCAM1 + WS-SSCAM1
COMPUTE WS-AMT2 = SSCHAM + WS-SSCHAM
ELSE
COMPUTE WS-AMT = WS-AMT1 + WS-AMT2
PERFORM 2070-WRITE-RDC-BC-CONSOL-FILE
INITIALIZE WS-GAD-FILE-RECORD
MOVE ZEROS TO WS-AMT1
MOVE ZEROS TO WS-AMT2
MOVE ZEROS TO WS-AMT
END-IF
MOVE SSTACB TO WS-SSTACB
MOVE SSCPWS TO WS-SSCPWS
MOVE SSBIN TO WS-SSBIN
MOVE SSCAM1 TO WS-SSCAM1
MOVE SSCHAM TO WS-SSCHAM
Back to top
View user's profile Send private message

Lijo

New User


Joined: 24 Aug 2008
Posts: 41
Location: Cochin

PostPosted: Thu Jan 21, 2010 4:43 pm    Post subject: Reply to: not getting correct amounts after compute amounts?
Reply with quote

If you post exact requirement and expected output, someone can help you out.

You're adding 'WS-AMT1 + WS-AMT2' in the code, but your requirement description doesn't talk about this:

Quote:
My requirement is calculate the sum of the amount of each bramch,user,bin fields
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8200
Location: East Dubuque, Illinois, USA

PostPosted: Thu Jan 21, 2010 8:17 pm    Post subject:
Reply with quote

Quote:
please provide me the logic.
Most of the responders on this forum are paid for their professional work product. Unless you are willing to pay their rates (and 1000 U.S. dollars per day or any fraction thereof is not an unusual rate), please do not ask for code.

What you are doing is called control breaks and Google is your friend: searching for cobol control break returned 38,100 hits. The first page of results has examples of control break logic.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10374
Location: italy

PostPosted: Thu Jan 21, 2010 8:24 pm    Post subject: Reply to: not getting correct amounts after compute amounts?
Reply with quote

You already posted a similar question!
http://ibmmainframes.com/viewtopic.php?p=221686&highlight=#221686
posting twice on the same issue will not get You double answers

what about doing a bit of homework Yourself???
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Is the explanation correct? XRST,CHKP Martylin IMS DB/DC 1 Wed Mar 15, 2017 9:26 am
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm
No new posts print out the correct info in LOOP? jackzhang75 CLIST & REXX 7 Wed Dec 23, 2015 10:39 pm
No new posts Displaying records per contract and a... madishpa DFSORT/ICETOOL 2 Mon Feb 16, 2015 7:39 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us