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
 
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 Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts Working with hex values in Filemanage... Emile Straker IBM Tools 0 Tue Sep 12, 2017 1:42 am
No new posts DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts BI,TO=ZD Changing Values Tyler Dunbar DFSORT/ICETOOL 4 Tue Jul 25, 2017 12:12 am

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