View previous topic :: View next topic
|
Author |
Message |
brganeshbabu
New User
Joined: 23 Jun 2005 Posts: 34 Location: Chennai
|
|
|
|
Hi,
I have two files FILE1 and FILE2 (ordinary PS). Both these files are in same format. I want to merge both these files into FILE3 such that if there is any duplicate record, only the record from FILE2 should be considered and not from FILE1. The key is first 10 characters, the Policy Number. I don't have ICETOOL. Can anyone tell me how to do this with ordinary SORT please ? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If you have DFSORT, you have ICETOOL. . .
Run any sort and post the informational messages generated by the run including the message ids. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
you can give this a try
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=FILE2
// DD DSN=FILE1
//SORTOUT DD DSN=FILE3
//SYSIN DD *
SORT FIELDS=(1,10,BI,A),EQUALS
SUM FIELDS=NONE
/*
|
Gerry |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Gerry,
I don't understand how sorting with EQUALS provides output to solve the TS's requirement?
Quote: |
I want to merge both these files into FILE3 such that if there is any duplicate record, only the record from FILE2 should be considered and not from FILE1 |
Bold attributes by me. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
From the doc. . .
Quote: |
EQUALS specifies that the order of output records with equal control fields is to be based on the file number of the input data sets and the original order of the records within each input data set. |
combined with the SUM FIELDS=NONE to discard all dups, should keep the first record from file 1. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Hi guys,
I miss-read the SORTIN concatenation. [img]head-up-my-butt[/img]
Gerry, your suggestion is a solution. |
|
Back to top |
|
|
brganeshbabu
New User
Joined: 23 Jun 2005 Posts: 34 Location: Chennai
|
|
|
|
Hi,
Thanks All. I will try tomorrow. I never knew ICETOOL is a part of DFSORT. I will learn it. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
ICETOOL has been a part of DFSORT since 1991!
Quote: |
combined with the SUM FIELDS=NONE to discard all dups, should keep the first record from file 1. |
Quote: |
Gerry, your suggestion is a solution |
It may or may not be a solution depending on what the OP actually wants to do which he hasn't described well enough for anyone to tell.
brganeshbabu,
It isn't clear what you want to do. Please show an example of the records in each input file (relevant fields only) and what you expect for output. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example. |
|
Back to top |
|
|
brganeshbabu
New User
Joined: 23 Jun 2005 Posts: 34 Location: Chennai
|
|
|
|
Hi,
It's working fine. Thanks all ![/img] |
|
Back to top |
|
|
|