Selecting only 10 records-DFSORT



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Selecting only 10 records-DFSORT

Postby ishwarya » Wed Dec 08, 2010 10:48 am

Hi all,

I have a requirement to select only 2 records(sequentially or randomly) from a file for a test purpose.The file is like this,

11111 abcd jhgsdkfg jngsdkfjh klafgsf
11111 reyty rrtgrtgrt fgdfgfgfg fgsdgh
11111 wqre qerwerer erwerrtre retrttry
11111 rtrte ewrertrt rwetrtrtre tgertrtr
22222 abcd jhgsdkfg jngsdkfjh klafgsf
22222 reyty rrtgrtgrt fgdfgfgfg fgsdgh
22222 wqre qerwerer erwerrtre retrttry
22222 rtrte ewrertrt rwetrtrtr tgertrtr

I need to select only 2 records from 11111 and 22222 keys.I can use INCLUDE condition if the number of records are few.But I have a very big file having keys count to 1000.Kindly help.
ishwarya
 
Posts: 1
Joined: Wed Dec 08, 2010 10:40 am
Has thanked: 0 time
Been thanked: 0 time

Re: Selecting only 10 records-DFSORT

 

Re: Selecting only 10 records-DFSORT

Postby Frank Yaeger » Wed Dec 08, 2010 11:08 pm

I don't understand how your Subject "Selecting only 10 records" relates to your question. If your records are already sorted by the key in positions 1-5 and you want the first two records with each key, you can use this DFSORT/ICETOOL job:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file
//OUT DD DSN=...  output file
//TOOLIN   DD   *
SELECT FROM(IN) TO(OUT) ON(1,5,CH) FIRST(2) USING(CTL1)
/*
//CTL1CNTL DD   *
  OPTION COPY
/*



SORTOUT would have:

11111 abcd jhgsdkfg jngsdkfjh klafgsf   
11111 reyty rrtgrtgrt fgdfgfgfg fgsdgh   
22222 abcd jhgsdkfg jngsdkfjh klafgsf   
22222 reyty rrtgrtgrt fgdfgfgfg fgsdgh   


If that's not what you want, then you need to do a better job of explaining what you do want with an example of input and expected output.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post