Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

To retain specific number of duplicate records through SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Sikkandhar

New User


Joined: 03 Dec 2007
Posts: 58
Location: Bangalore

PostPosted: Tue Aug 20, 2013 11:20 am    Post subject: To retain specific number of duplicate records through SORT
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: 8593
Location: Back in jolly old England

PostPosted: Tue Aug 20, 2013 12:01 pm    Post subject:
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: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Aug 20, 2013 12:17 pm    Post subject:
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: 58
Location: Bangalore

PostPosted: Tue Aug 20, 2013 12:17 pm    Post subject:
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: 58
Location: Bangalore

PostPosted: Tue Aug 20, 2013 1:49 pm    Post subject:
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: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Aug 20, 2013 1:50 pm    Post subject:
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: 1445
Location: Azeroth

PostPosted: Tue Aug 20, 2013 2:52 pm    Post subject:
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: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Aug 20, 2013 3:02 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us