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

To retain specific number of duplicate records through SORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Sikkandhar

New User


Joined: 03 Dec 2007
Posts: 61
Location: Bangalore

PostPosted: Tue Aug 20, 2013 11:20 am
Reply with quote

Hi,

I have a file which is to be sorted on first 10 bytes (Charector). The output file should contain 1st 5 (5 or less but not more than 5) duplicate records. If there are only 1 record, then the output should contain only that record

Code:

1234567890AAAAAAAAAAAAAA
1234567890BBBBBBBBBBBBBB
1234567890CCCCCCCCCCCCCC
1234567890DDDDDDDDDDDDDD
1234567890AAAAAAAAAAAAAA
1234567890EEEEEEEEEEEEEE
1234567890FFFFFFFFFFFFFF
5555567890ZZZZZZZZZZZZZZ
6666567890YYYYYYYYYYYYYY
6666567890VVVVVVVVVVVVVV
6666567890XXXXXXXXXXXXXX


The above file has to be sorted on the 1st 10 byte. There are 3 Unique Keys
1234567890 - Has 7 records
5555567890 - Has 1 record
6666567890 - Has 3 records.

So my Output file should contain 1st 5 records from 1234567890, 1 record from 5555567890 and 3 records from 6666567890 .

The Output file should look like below

Code:

1234567890AAAAAAAAAAAAAA
1234567890BBBBBBBBBBBBBB
1234567890CCCCCCCCCCCCCC
1234567890DDDDDDDDDDDDDD
1234567890AAAAAAAAAAAAAA
5555567890ZZZZZZZZZZZZZZ
6666567890YYYYYYYYYYYYYY
6666567890VVVVVVVVVVVVVV
6666567890XXXXXXXXXXXXXX


Can you please help me in developing a Sort Card for the above requirement.

Thanks
Sikkandhar
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Aug 20, 2013 12:01 pm
Reply with quote

Please run the below piece of code and post the SYSOUT segment from the output so that we can see which product and release level you have installed.
Code:
//SORTCOPY EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*   
//SORTIN   DD *         
DUMMY                   
/*                       
//SORTOUT  DD SYSOUT=*   
//SYSIN    DD *         
  OPTION COPY           
/*                       
//                       
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Aug 20, 2013 12:17 pm
Reply with quote

Assuming that you have Syncsort(since you have posted here in JCL forum), and if you are able to use SYNCTOOL, you can try with SELECT and FIRST. Something like:
Code:
SELECT FROM(IN) TO(OUT) ON(1,10,CH) FIRST(5)
Back to top
View user's profile Send private message
Sikkandhar

New User


Joined: 03 Dec 2007
Posts: 61
Location: Bangalore

PostPosted: Tue Aug 20, 2013 12:17 pm
Reply with quote

Hi Expat,

Due to Security reasons, am not allowed to paste the entire SYSOUT. Am pasting only the selected information

Code:
1 SYNCSORT FOR Z/OS  1.4.0.1R     (C) 2010 SYNCSORT INC.   DATE=2013/232   TIME=02.42.17

z/OS   1.13.0 

WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000             
WER416B  BSAM WAS USED FOR SORTIN                         
WER416B  BSAM WAS USED FOR SORTOUT                       
WER054I  RCD IN          1, OUT          1               
WER169I  RELEASE 1.4 BATCH 0520 TPF LEVEL 0.1   


Please let me know if you need more information.

Thanks
Sikkandhar
Back to top
View user's profile Send private message
Sikkandhar

New User


Joined: 03 Dec 2007
Posts: 61
Location: Bangalore

PostPosted: Tue Aug 20, 2013 1:49 pm
Reply with quote

Thanks Mistah Kurtz. The control card works fine for my requirement

Sikkandhar
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Aug 20, 2013 1:50 pm
Reply with quote

you're welcome icon_smile.gif
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Tue Aug 20, 2013 2:52 pm
Reply with quote

Crossed 100 safely.. congrats :-)
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Aug 20, 2013 3:02 pm
Reply with quote

Quote:
Crossed 100 safely.. congrats :-)

Thanks icon_smile.gif
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top