View previous topic :: View next topic |
Author |
Message |
cobcurious Beginner
![](images/avatars/gallery/cartoons/WB136.gif)
Joined: 04 Oct 2003 Posts: 68 Topics: 25
|
Posted: Sat Aug 28, 2010 10:19 am Post subject: Select only x records |
|
|
Hi Experts,
We have a dataset containing unique identifiers and associate data. The dataset is sorted on the unique identifiers. The count of unique identifiers may vary from 1 to any number. I need to select 30 records of each unqiue identifier. If there are less than 30 records...say 25 for a given unique identifier then I need all the records (25) corresponding to that identifier.
Please advise as to how we can do using DFSORT? We found a workaround by using EZYTREIVE. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
papadi Supermod
Joined: 20 Oct 2009 Posts: 594 Topics: 1
|
Posted: Sat Aug 28, 2010 1:19 pm Post subject: |
|
|
Easytrieve is not a workaround - it is currently your solution
Post some sample data and the output you want from the sample data. Mention the dsorg and lrecl of the files and the relevant data positions. _________________ All the best,
di
Last edited by papadi on Sat Aug 28, 2010 2:05 pm; edited 1 time in total |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
kolusu Site Admin
![Site Admin Site Admin](images/ranks/adminpic.jpg)
Joined: 26 Nov 2002 Posts: 12370 Topics: 75 Location: San Jose
|
Posted: Sat Aug 28, 2010 1:33 pm Post subject: |
|
|
cobcurious,
You can now use the SELECT FIRST(n) function to do this more easily like this. I assumed your unique identifier is in the first 8 bytes.
Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//FIRST30 DD DSN=... output file
//TOOLIN DD *
SELECT FROM(IN) TO(FIRST30) ON(1,8,CH) FIRST(30)
//* |
For complete details on the new FIRST(n) function and the other new functions available with PTF UK90013, see:
www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/ _________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
www.linkedin.com/in/kolusu |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
cobcurious Beginner
![](images/avatars/gallery/cartoons/WB136.gif)
Joined: 04 Oct 2003 Posts: 68 Topics: 25
|
Posted: Mon Aug 30, 2010 11:18 pm Post subject: |
|
|
Hi Kolusu,
Thanks, let me try it out. I am sure it will work. Thanks in advance. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
|
|