Select only x records
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> Utilities

#1: Select only x records Author: cobcurious PostPosted: Sat Aug 28, 2010 10:19 am
    —
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.

#2:  Author: papadi PostPosted: Sat Aug 28, 2010 1:19 pm
    —
Easytrieve is not a workaround - it is currently your solution Smile

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.


Last edited by papadi on Sat Aug 28, 2010 2:05 pm; edited 1 time in total

#3:  Author: kolusuLocation: San Jose PostPosted: Sat Aug 28, 2010 1:33 pm
    —
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/

#4:  Author: cobcurious PostPosted: Mon Aug 30, 2010 11:18 pm
    —
Hi Kolusu,

Thanks, let me try it out. I am sure it will work. Thanks in advance.



MVSFORUMS.com -> Utilities


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group