Page 1 of 2

Remove dulicates from the file using sort step.

PostPosted: Sat Oct 10, 2009 3:23 pm
by shafeequehere
Hi,

I have two files File1 and File2.

column 1 and column 2 are keys.

I need to merge these two files, In case of duplicates, the record in the File1 wins.

How can I do that using Sort step in JCL?

Ex : File1 has following data

column 1 column 2 column 3 column 4 column 5
12 shaf 10 20 30

Ex : File2 has following data

column 1 column 2 column 3 column 4 column 5
12 shaf 11 21 31

In this case it is unique by column1 and column2 . So record in the file1 should win.

Re: Remove dulicates from the file using sort step.

PostPosted: Sun Oct 11, 2009 3:33 am
by dick scherrer
Hello and welcome to the forum,

Which sort product (and which release) is used on this system?

Depending on which sort product is used and how current the release, the way to do this may vary.

Re: Remove dulicates from the file using sort step.

PostPosted: Sun Oct 11, 2009 2:58 pm
by shafeequehere
Please tell me the way how normal sorting is done to solve the above mentioned problem.

I am not sure of the sort prouct and release.

Re: Remove dulicates from the file using sort step.

PostPosted: Mon Oct 12, 2009 11:34 pm
by dick scherrer
Hello,

I am not sure of the sort prouct and release.
Then run some sort and look at the informational output. . .

Please tell me the way how normal sorting is done to solve the above mentioned problem.
Depending on which sort product is used and how current the release, the way to do this may vary.
Was there something not clear here? Depending on the product, the code may vary. . .

Re: Remove dulicates from the file using sort step.

PostPosted: Wed Oct 14, 2009 7:54 pm
by shafeequehere
I think it is 1.2.3.1R

Re: Remove dulicates from the file using sort step.

PostPosted: Wed Oct 14, 2009 11:49 pm
by dick scherrer
Hello,

I suspect that is Syncsort. . . Which would be in the same output where the 1.2.3.1R was found. . .

Suggest you review JOINKEYS in the documentation.

If this IS a Syncsort question, i'll move your topic to the Syncsort part of the forum.

Re: Remove dulicates from the file using sort step.

PostPosted: Sun Oct 18, 2009 3:20 pm
by shafeequehere
Yes....This a Syncsort

Re: Remove dulicates from the file using sort step.

PostPosted: Mon Oct 19, 2009 9:23 pm
by shafeequehere
Please move this topic to the Syncsort part of the forum and get this done.

Re: Remove dulicates from the file using sort step.

PostPosted: Mon Oct 19, 2009 10:22 pm
by Alissa Margulies
shafeequehere,

As long as there are no duplicate keyed records within FILE1 or FILE2 themselves, you should be able to use the following sort step:

//SORT1 EXEC PGM=SORT,PARM='EQUALS'   
//SYSOUT DD SYSOUT=*                   
//SORTIN DD DSN=FILE1,DISP=SHR         
//       DD DSN=FILE2,DISP=SHR         
//SORTOUT DD SYSOUT=*                 
//SYSIN     DD   *                     
   SORT FIELDS=(1,2,CH,A,4,4,CH,A)     
   SUM FIELDS=NONE                     
/*                                     

If there are duplicates within File1 or File2, let me know and I'll modify the code for you.

Re: Remove dulicates from the file using sort step.

PostPosted: Mon Oct 19, 2009 11:54 pm
by dick scherrer
Hello,

Please move this topic to the Syncsort part of the forum and get this done.
Continue with this attitude and your posts will be deleted. Just who do you think you are to post "get this done". . . :roll:

It would also probably be good if you paid the slightest bit of attention - the topic was relocated long before this nonsense post was entered. . . :evil:

d