Posted: Tue Dec 16, 2008 3:39 am Post subject: How to Split file based on record count
I am not sure if this is possible, but I thought I will put this question out.
I have a file that has many sets of multiple records with the same key (eg a set of 50 records with one key, another set of say 20 records with another key etc).I need to get all the sets that have more than 40 records into one output file and the rest in another output file. Is this at all possible using sort? if so can someone enlighten me?
Joined: 18 Feb 2006 Posts: 812 Location: San Jose, CA
Posted: Tue Dec 16, 2008 5:52 am Post subject:
You can use a DFSORT/ICETOOL job like the following to do what you asked for. I assumed your key was in positions 1-3, but you can change the ON field appropriately to reflect the actual key positions.
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:
Thanks a lot for the guidance. It worked.
I however have another situation. I want the sort hapenning on 2 different fields in the file.(eg, I want to sort on 1,3,ch and within that on 7,1,ch, before splitting the file to two files). I tried the following card, but it Icetool apparently allow sort on two different files
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum