View previous topic :: View next topic
|
Author |
Message |
lagneshp
New User
Joined: 15 Aug 2009 Posts: 29 Location: Chennai
|
|
|
|
Hi,
if my input file has duplicate values i want my output file to copy only non duplicate record.
Sortfields=none will remove all duplicates and retain one row from it.
but what i need is if more than one same records are there the i dont want to copy all those record to my output file.
Ex:
I/P
123 aaa
123 aaa
123 aaa
999 ccc
Expected O/P
999 ccc
I dont want to copy 123 aaa as it have duplicate rows.
some one Guide me plz |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
answering because of duplicate post/topic,
thanks to expat for the following text ...
This has been dicussed quite a few times and various examples exist in both the DFSORT and JCL forums. But, because the solution for sort related questions may vary from product to product, please ensure that you state clearly which sort product you are using.
If you are not sure, then by running a simple sort step shown below, you will be able to find out for yourself.
If the messages start with ICE then your product is DFSORT. Please also post the output of the complete line which has a message code ICE201I, as this will enable our DFSORT experts to determine which release of DFSORT that you have installed. This may also affect the solution offered.
If the messages start with WER or SYT then the product is SYNCSORT and the topic will be moved into the JCL forum by one of the moderators. Please also post the information telling which version of SYNCSORT is installed, as this may also affect the solution offered.
Thank you for taking your time to ensure that the valuable time of others is not wasted by offering inappropriate solutions which are not relevant due to the sort product being used and/or the release that is installed in your site.
Code: |
//SORTSTEP EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
ABC
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY |
after You post the <sort> you are using somebody will delete the useless duplicate |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
since You are using SYNCSORT the duplicate post on the dfsort forum was deleted |
|
Back to top |
|
|
lagneshp
New User
Joined: 15 Aug 2009 Posts: 29 Location: Chennai
|
|
|
|
Hi my
I/P :
000001 0000000000000000000000
000002 0010000000040100138375996
000003 0020000000040100138375996
000004 0030000000040100138375996
000005 0040000000040100152384996
000006 0040000000040100286372996
000007 0040000000040100295365996
000008 0040000000040100376389996
000009 0040000000040100427372996
000010 0040000000040100435375996
My Expected Output:
000001 0000000000000000000000
000005 0040000000040100152384996
000006 0040000000040100286372996
000007 0040000000040100295365996
000008 0040000000040100376389996
000009 0040000000040100427372996
000010 0040000000040100435375996
I dont want any of the duplicate records
I am using syncsort
using sort fields=none , i can only remove duplicates but it will copy first record of it.
In my case i dont want any duplicate records.
Please help me in this. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
INREC insert a constant of 0001.
SORT on the key and SUM on the constant.
OUTREC OMIT where the summed constant is greater than one. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Good answer CICS guy.
Here we use the saying 'what is the vegas line for....'
In this case: what is the vegas line that the ts will ask for the syntax/code for same?
I make it better than even money at 1 to 2 (meaning you have to bet 2 dollars to win 1). |
|
Back to top |
|
|
dneufarth
Active User
Joined: 27 Apr 2005 Posts: 419 Location: Inside the SPEW (Southwest Ohio, USA)
|
|
|
|
Quote: |
what is the vegas line that the ts will ask for the syntax/code for same? |
o ye of little faith
I won't take the bet though |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
daveporcelan wrote: |
Good answer CICS guy. |
Thanks, I just point, mostly because that's how I learned.
Quote: |
In this case: what is the vegas line that the ts will ask for the syntax/code for same? |
I'll bet that he won't even have to ask...... |
|
Back to top |
|
|
lagneshp
New User
Joined: 15 Aug 2009 Posts: 29 Location: Chennai
|
|
|
|
Hi Guys,
Its good to sse that u bet on this
I executed with below code
//SYSIN DD *
INREC FIELDS=(1:1,25,26:C'001')
SORT FIELDS=(7,16,CH,A)
SUM FIELDS=(26,3,ZD)
//SYSIN DD *
SORT FIELDS=COPY
OMIT COND=(26,3,CH,GT,C'001')
/*
Its working fine..
Thanks,
See you with some other queries
............................. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
lagneshp,
You can include the OMIT in the OUTFIL of the first sort pass and avoid the need for a second pass. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Or else you can make use of the SYNCTOOL SELECT operator with NODUPS to get only unique values like this.
Code: |
//STEP1 EXEC PGM=SYNCTOOL
//IN DD DSN=Input file
//OUT DD DSN=Output file
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(7,16,CH) NODUPS
/* |
|
|
Back to top |
|
|
|