IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

deduplicating on matching keys / remaining record sums field


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Wilsy

New User


Joined: 29 Dec 2007
Posts: 5
Location: UK

PostPosted: Wed Apr 09, 2008 4:26 pm
Reply with quote

Here is a simplified example of what I need.
I have four records on aN INPUT file as follows

D155555000030000200001
D166666000040000800007
D155555000020000400005
D166666000090001200246

I need to merge the records on the first 7 characters but at the same time sum three fields in positions 8 for 5, 13 for 5 and 18 for 5.
The OUTPUT file would then look like this

D155555000050000600006
D166666000130002000253

Any help with the statements required to achieve this is much appreciated.
Wilsy
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Apr 09, 2008 8:44 pm
Reply with quote

Wilsy,

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
D155555000030000200001
D166666000040000800007
D155555000020000400005
D166666000090001200246
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  SORT FIELDS=(1,7,CH,A)
  OPTION ZDPRINT
  SUM FIELDS=(8,5,ZD,13,5,ZD,18,5,ZD)
/*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
Wilsy

New User


Joined: 29 Dec 2007
Posts: 5
Location: UK

PostPosted: Wed Apr 09, 2008 9:05 pm
Reply with quote

Thanks Frank
I have downloaded the manuals. They are proving helpful with some other stuff I have to do. No "code changes" (except JCL) allowed at this stage of the project for some bizzare reason but I think you can do almost anything with these sorts. Very powerful software.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top