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
 

 

Sum the values of amount

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
tanguduk
Warnings : 1

New User


Joined: 29 Aug 2005
Posts: 14

PostPosted: Tue Jan 20, 2009 3:37 pm    Post subject: Sum the values of amount
Reply with quote

Hi ,

I have requirment like this ,

I have the file like ,

emp_nr month/year Amount
000000042 03/2001 E E 001 0.000 328.32
000000042 03/2001 E E 320 0.000 103.63
000000042 03/2001 E E 370 0.000 4.56
000000042 03/2001 E E 400 0.000 -0.01

I want to sum the values for 3/2001 amount

000000042 03/2001 E E 0.000 436.5

I have different months 1/2001 to 12/2001



Please let me know How can I achieve this


Regards
Kiran
Back to top
View user's profile Send private message

km_abdullah

New User


Joined: 03 Nov 2008
Posts: 60

PostPosted: Tue Jan 20, 2009 4:25 pm    Post subject:
Reply with quote

Hi,

Just check if the below discussed topics helps.

http://ibmmainframes.com/viewtopic.php?t=29183&highlight=sumfields

http://ibmmainframes.com/viewtopic.php?t=9625&highlight=sumfields
Back to top
View user's profile Send private message
tanguduk
Warnings : 1

New User


Joined: 29 Aug 2005
Posts: 14

PostPosted: Tue Jan 20, 2009 6:36 pm    Post subject: Reply to: Sum the values of amount
Reply with quote

Hi Arun,

Starting position and length are

for month/year ---starting position 12 lenth 7
and I have to add amounts whicch is at 41 positon length 7

Regards
kiran
Back to top
View user's profile Send private message
tanguduk
Warnings : 1

New User


Joined: 29 Aug 2005
Posts: 14

PostPosted: Tue Jan 20, 2009 8:33 pm    Post subject: Reply to: Sum the values of amount
Reply with quote

I have written the below code for my req

INREC OVERLAY=(41:41,7,SFF,TO=ZD,LENGTH=7)
SORT FIELDS=(12,7,CH,A)
SUM FIELDS=(41,8,ZD)
OUTREC OVERLAY=(41:41,7,ZD,EDIT=(STTTTT.T),SIGNS=(,-))

for summing the amount for particular year say all the amounts for 1/2001,3/2001,3/2001,
and so on up to 12/2001 but I am not getting the result as expeted

Suppose I have like

000000042 03/2001 E E 001 0.000 328.32
000000042 03/2001 E E 320 0.000 103.63
000000042 03/2001 E E 370 0.000 4.56
000000042 03/2001 E E 400 0.000 -0.01


then I want as below,


000000042 03/2001 E E 0.000 436.5

Please Suggest
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Jan 20, 2009 9:56 pm    Post subject:
Reply with quote

Based on what you've said and shown, I believe these DFSORT control statements will give you what you want:

Code:

  INREC OVERLAY=(41:41,7,SFF,TO=ZD,LENGTH=7)               
  SORT  FIELDS=(12,7,CH,A)                                 
  SUM FIELDS=(41,7,ZD)                                     
  OUTREC OVERLAY=(41:41,6,ZD,EDIT=(SIIIIT.T),SIGNS=(,-))   


The output I get with your input example is:

Code:

000000042  03/2001 E E 001     0.000       436.5


If you want to remove the '001' field and/or output the fields in different positions, you can use an appropriate BUILD operand instead of an OVERLAY operand to do that.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts setting new limit Key values for inde... srilata83 DB2 1 Fri Feb 10, 2017 9:24 pm
No new posts Remove junk values in a file and rite... KP1125 DFSORT/ICETOOL 2 Wed Jan 25, 2017 9:58 pm


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