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 with Sum fields in SOrt

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

New User


Joined: 29 May 2008
Posts: 15
Location: CHENNAI

PostPosted: Thu Aug 06, 2009 1:02 pm    Post subject: Help Needed with Sum fields in SOrt
Reply with quote

hi

Can Any one help me in addressing the issue related to summing of the fields using sum fields option in sort.

I have a file with three columns as shown below


Code:

62152115              +72.000              16109
62152115              -24.000              16109
62152115               24.000              16448
62152115               24.000              19177
62152115               48.000              19208
62152115               24.000              19213
62152115               24.000              19244
62152115             +120.000              16109


and i need to add the column 2 records when the column1 and column3 combinations are repeated

For instance : for this input

62152115 72.000 16109
62152115 -24.000 16109

in the output i need only one record that should have

Code:
62152115               48.000              16109
Back to top
View user's profile Send private message

gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Thu Aug 06, 2009 5:21 pm    Post subject:
Reply with quote

Hi,

what about this line ?
Code:
62152115             +120.000              16109


Gerry
Back to top
View user's profile Send private message
pnr kishore

New User


Joined: 29 May 2008
Posts: 15
Location: CHENNAI

PostPosted: Thu Aug 06, 2009 5:44 pm    Post subject:
Reply with quote

hi,

Even this Record has to be accounted . For Better understanding i have take only two records to illustrate my requirement.

Quote:

For instance : for this input

62152115 72.000 16109
62152115 -24.000 16109

in the output i need only one record that should have
62152115 48.000 16109
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: Thu Aug 06, 2009 8:49 pm    Post subject:
Reply with quote

You can use a DFSORT job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
62152115              +72.000              16109
62152115              -24.000              16109
62152115               24.000              16448
62152115               24.000              19177
62152115               48.000              19208
62152115               24.000              19213
62152115               24.000              19244
62152115             +120.000              16109
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  INREC OVERLAY=(21:21,9,SFF,TO=ZD,LENGTH=9)
  SORT FIELDS=(1,8,CH,A,44,5,CH,A)
  SUM FIELDS=(21,9,ZD)
  OUTREC OVERLAY=(21:21,9,ZD,EDIT=(SIIIT.TTT),SIGNS=(+,-))
/*


SORTOUT would have:

Code:

62152115             +168.000              16109     
62152115              +24.000              16448     
62152115              +24.000              19177     
62152115              +48.000              19208     
62152115              +24.000              19213     
62152115              +24.000              19244     
Back to top
View user's profile Send private message
pnr kishore

New User


Joined: 29 May 2008
Posts: 15
Location: CHENNAI

PostPosted: Fri Aug 07, 2009 3:35 pm    Post subject:
Reply with quote

Thanks Alot icon_biggrin.gif
it worked for me...
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 Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm


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