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
 
how to calculate total chrg calculation based on sales no

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
santhunaveen

New User


Joined: 22 Sep 2006
Posts: 33

PostPosted: Tue Jul 10, 2007 3:24 pm    Post subject: how to calculate total chrg calculation based on sales no
Reply with quote

hi,

I have a input file like,

sales number total charge
001 200
002 100
001 300
002 200
003 100
004 200
002 100
001 100


My output should be like,

sales number total charge
001 600
002 400
003 100
004 200


Could any one please provide the suedo code for this....this shd be done by COBOL+DB2 prog.............
Back to top
View user's profile Send private message

priyamnavada

New User


Joined: 24 Dec 2005
Posts: 52
Location: hyderabad

PostPosted: Tue Jul 10, 2007 3:39 pm    Post subject:
Reply with quote

what are the possible values for the sales number?

if its only these 4 numbers then,

read the sales number, and declare one variable for a particular sales number. if its a particualre sales number (for say-001) then increment the variable with the total charge. first increment should be from zero.

Please let me know if you have nay concern,
Back to top
View user's profile Send private message
muthuvel

Active User


Joined: 29 Nov 2005
Posts: 217
Location: Chennai

PostPosted: Tue Jul 10, 2007 3:46 pm    Post subject: Re: how to calculate total chrg calculation based on sales n
Reply with quote

i am not sure of your complete requirement.Based on my understanidngs,

Sort the input file based on sales no.

1)Read the Sorted input file.
2)Compare the Sales no of the previous read record and Sales no of current read record
a) if they match,accumulate the charge.
b)if the previous sales no does not match with the current,then move the previous sales no and accumalated charge to the output record and write the output file.
C)Continue the process till the end of file is reached.

Hope this gives an idea..
Back to top
View user's profile Send private message
santhunaveen

New User


Joined: 22 Sep 2006
Posts: 33

PostPosted: Tue Jul 10, 2007 4:02 pm    Post subject:
Reply with quote

hi thanks for the reply...

but for example I have given 8 records in the input file...but in input file i have 1000 records like this.......

my output should be like...for every sales number(for example sales number 001),total charge(for example 600) related to that sales number(for example sales nuber 001) shd be totalled and display in output file.........
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue Jul 10, 2007 4:03 pm    Post subject: Re: how to calculate total chrg calculation based on sales n
Reply with quote

santhunaveen wrote:
Could any one please provide the suedo code for this....this shd be done by COBOL+DB2 prog.............
Where does the DB2 part come from?
The way you have specified your requirements, sort would be the best choice.
Back to top
View user's profile Send private message
santhunaveen

New User


Joined: 22 Sep 2006
Posts: 33

PostPosted: Tue Jul 10, 2007 5:49 pm    Post subject:
Reply with quote

Hi thanks for the reply....

COBOL+DB2 prog..I mean to say thru DB2 query only i have created the inputfile.....and I want to get the output file that should be in a format i have specified above.................
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Jul 10, 2007 5:58 pm    Post subject:
Reply with quote

santhunaveen wrote:
Hi thanks for the reply....

COBOL+DB2 prog..I mean to say thru DB2 query only i have created the inputfile.....and I want to get the output file that should be in a format i have specified above.................


From what you have said so far DB2 does not apply to the problem.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue Jul 10, 2007 7:23 pm    Post subject:
Reply with quote

If the input is a DB2 query, then it can be part of the solution, what query retrieved the data?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Jul 10, 2007 7:47 pm    Post subject:
Reply with quote

William Thompson wrote:
If the input is a DB2 query, then it can be part of the solution, what query retrieved the data?


According to the OP
Quote:
I have a input file like,

sales number total charge
001 200
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue Jul 10, 2007 8:36 pm    Post subject:
Reply with quote

Your point?

According to the OP
Quote:
I mean to say thru DB2 query only i have created the inputfile
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 -> 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 BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts How do you create Eclipse based dialogs jasorn IBM Tools 0 Thu Aug 03, 2017 5:05 pm
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm
No new posts Wanted to calculate TRK when i have B... Balu5491 JCL & VSAM 9 Wed Jul 19, 2017 5:43 pm
No new posts DSNACCOX (can it be run on 1 db/ts, t... SRICOBSAS DB2 5 Sat May 06, 2017 12:59 am

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