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
 

 

Help Needed to sum two columns using sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
naveen.prabhu.p

New User


Joined: 20 Sep 2006
Posts: 4
Location: Bangalore

PostPosted: Wed Oct 11, 2006 12:03 pm    Post subject: Help Needed to sum two columns using sort
Reply with quote

My input file has data as mentioned below,

Code:

AAA     -31.00     0001
AAA       1.00     0001
AAA     111.00     0001
BBB      34.00     0001
BBB     222.00     0001
CCC      14.00     0001
CCC     -22.00     0001



expected output :

Code:

AAA      81.00     0003
BBB     256.00     0002
CCC      -8.00     0002


Can anyone please help me out with this??
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Oct 11, 2006 12:24 pm    Post subject:
Reply with quote

Hi there,

would u please tell me field length & offset that will be helpful to provide u sort card
Back to top
View user's profile Send private message
naveen.prabhu.p

New User


Joined: 20 Sep 2006
Posts: 4
Location: Bangalore

PostPosted: Wed Oct 11, 2006 1:50 pm    Post subject: Hi Ekta,
Reply with quote

Hi Ekta,

Actually i have the input file as,
(1,13) is trans type PIC X(13).
(14,6) filler
(20,10) is the Trans date pic x(10)
(30,2) filer
(32,13) is trans amount PIC -Z(8)9.99
(45,5) filler
(50,7) has constant 0000001 (pic x(7))
(57,123) filler.

I need to get, Total no of each transaction type, total amount against each type.

I hope this explanation would let you know my problem.

Thanks in advance,
Naveen
Back to top
View user's profile Send private message
mubs55

New User


Joined: 19 Apr 2006
Posts: 12

PostPosted: Wed Oct 11, 2006 2:13 pm    Post subject: Solution for-Help Needed to sum two columns using sort
Reply with quote

Hi Naveen,

heres the solution for ur problem

Code:

//SORT01    EXEC PGM=ICEMAN                                     
//SORTIN   DD DSN=INPUT FILE,DISP=SHR                           
//SORTOUT  DD DSN=OUTPUT FILE,DISP=OLD                         
//SYSOUT    DD SYSOUT=*                                         
//SYSIN    DD *                                                 
  SORT FIELDS=(1,15,CH,A)                                       
  OUTFIL REMOVECC,NODETAIL,                                     
     SECTIONS=(1,15,                                           
     TRAILER3=(1,20,                                           
     32:TOT=(32,13,SFF,EDIT=(STTTTTTTTTT.TT),SIGNS=(,-)),       
     50:TOT=(50,7,ZD,EDIT=(TTTTTTT))))                         
Back to top
View user's profile Send private message
naveen.prabhu.p

New User


Joined: 20 Sep 2006
Posts: 4
Location: Bangalore

PostPosted: Wed Oct 11, 2006 2:30 pm    Post subject: Thanks
Reply with quote

Thanks Mubs, that solved my problem
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 Sort Card to Remove Duplicate records... raj4neo SYNCSORT 0 Wed Jan 25, 2017 4:44 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am


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