View previous topic :: View next topic |
Author |
Message |
suresh05 Beginner
Joined: 14 Sep 2005 Posts: 18 Topics: 8
|
Posted: Thu Sep 15, 2005 10:21 am Post subject: Tricky file compare |
|
|
Hi,
I wanted to know if this file comparison can be done using Syncsort. Please help me..
File 1
Field-1 Field-2
12345 11111
12345 22222
12346 11222
12346 11333
12333 33333
12333 44444
File 2
Field-1
11111
12345
22222
11333
33333
11222
12346
44444
Output File
12345
11111
22222
12346
11222
11333
Condition is
If there is a match between File1 field-1 and File2 field-2 then file2 should be written to output file.
Then File1 field2 should be compared with File2 field 2 and if there is a match file2 should be written to the output file.
Else
Skip to the next record (record should not be written to the output file)
record should be of same order of File-1 sequence.
Please help me if this comparison can be done using Syncsort.
Both the files are FB lrecl 80 and the key fields is PIC 9(5)
Only File 1 field1 will have duplicates remaining key fields in File1 filed2 & File2 Field 1 are unique |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
|
Posted: Thu Sep 15, 2005 10:37 am Post subject: |
|
|
Quote: |
If there is a match between File1 field-1 and File2 field-2 then file2 should be written to output file.
Then File1 field2 should be compared with File2 field 2 and if there is a match file2 should be written to the output file.
|
Where is field-2 in file2?
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
suresh05 Beginner
Joined: 14 Sep 2005 Posts: 18 Topics: 8
|
Posted: Thu Sep 15, 2005 11:00 am Post subject: |
|
|
oops sorry. it's File2 field-1 |
|
Back to top |
|
|
Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Fri Sep 16, 2005 6:19 am Post subject: |
|
|
Suresh05,
There are already tons of questions answered on file comparison / matching. Please take some time and see if you can build on that.
Anyway, I have no problems answering this question. But looking at your input files, the keys does not appear Unique. So, the regular MATCH Logic (SUM FIELDS) won't work for you. You need to go in for SPLICE which is actually an unsupported-undocumented feature of Syncsort.
SPLICE is available only with Syncsort v 1.1 and above. So, write some dummy sort step and post your sysout message. The first line contains the Syncsort version your shop is running on.
Thanks,
Phantom |
|
Back to top |
|
|
suresh05 Beginner
Joined: 14 Sep 2005 Posts: 18 Topics: 8
|
Posted: Fri Sep 16, 2005 6:24 am Post subject: |
|
|
I have Syncsort 1.4.0
z/OS 1.4.0 CPU MODEL 2084 |
|
Back to top |
|
|
suresh05 Beginner
Joined: 14 Sep 2005 Posts: 18 Topics: 8
|
Posted: Fri Sep 16, 2005 6:33 am Post subject: |
|
|
Sorry .. it's SYNCSORT 3.7DR |
|
Back to top |
|
|
Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Fri Sep 16, 2005 6:35 am Post subject: |
|
|
Suresh05,
I think you are looking at the output of Synctool. Thats not the one you need to look at. The latest version of Syncsort is v 1.2. use PGM=SORT and show us the SYSOUT. (Don't use PGM=SYNCTOOL/ICETOOL).
Thanks,
Phantom |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
|
Posted: Fri Sep 16, 2005 7:41 am Post subject: |
|
|
Phantom,
Suresh has syncsort v 3.7 which is a old version and splice is not supported in that version. see his post just above your post.
However his problem can be solved without splice, but I don't have time to work on it.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Fri Sep 16, 2005 11:42 pm Post subject: |
|
|
Kolusu,
My message was with reference to "z/OS 1.4.0 CPU MODEL 2084". probably both of us wrote at the same time. Also, after sending in my reply I went to Forums Index. So, didn't get a chance to see and correct myself. My apologies. Hope you remember that I was working on the same version of sort sometime back !...
Suresh05,
Syncsort 3.7 does not support SPLICE and many other powerful features. So, writing a code for you will be all the more tricky. we have to use Dynamic (INCLUDE COND=) sort control cards. But there is a limitation on the number of records that can be accomodated in such dynamic cards (Although there is a way to overcome this by using MINCORE parm).
How many unique records can you expect in your file 1 and file 2. In case of file1, I need unique count of field 1 and field 2 separately. If they are in few hundreds we can do using dynamic INCLUDEs. Else this is not possible with your version of sort.
Thanks,
Phantom |
|
Back to top |
|
|
|
|