View previous topic :: View next topic
|
Author |
Message |
kalakuntlavenkat
New User
Joined: 10 Nov 2008 Posts: 6 Location: Hyderabad
|
|
|
|
Hi All,
I need help on sort utility to compare the records with in the file(taking first record and I want to compare with second record and second record with third record and so on....) and I want to insert a 'X" to that first record at end of the record if first records differed to second record after comparison.
record are on sorted order only based on this 4 fields.
for example -
Code: |
POL_NBR(7)MODU_NBR(2) POL_EFF_DT(8) LOB(6)
A0EE8D8 26 20150914 664702
G29DST5 01 2015-07-18 664503
G29DST6 01 2015-07-18 664503
G29DTTC 01 2015-09-20 664503
G2B3BV8 09 2015-09-21 664503
G2B3Z5W 10 2015-09-20 664503
G2B975T 11 2015-09-18 664503
G2B975V 11 2015-09-18 664503
G2BNN30 07 2010-07-08 664503
G2BNN30 08 2011-07-08 664503
G2BR8XG 11 2015-09-29 664503
G2BRV9K 10 2015-02-17 664503
G2BTXWG 07 2014-11-01 664503
G2BV11F 08 2015-02-02 664503
G2BV11F 08 2015-02-02 664503
G2BV11F 08 2015-02-02 664503
G2BV11F 08 2015-02-02 664503
G2BV11F 08 2015-02-02 664503
G2BV5KB 10 2015-09-06 664503 |
Thanks in advance for the help.
Code'd |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Use JOINKEYS with the same dataset for both inputs.
Using JNF1CNTL, extend your record with a sequence number starting at one.
Using JNF2CNTL, extend your record with a sequence number starting at zero.
JOIN UNPAIRED,F1
Specify all your data from both files in the REFORMAT statement.
Compare. Output your data with BUILD on INREC in the main task.
The final F1 record will be unmatched.
There are examples here. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
Back to top |
|
|
kalakuntlavenkat
New User
Joined: 10 Nov 2008 Posts: 6 Location: Hyderabad
|
|
|
|
Thanks Bill,
I need one more help on sorting
I am planning to compare two files based on fields located in different position(not at same place ) in the files. But the fields position in the two files are same.
I want compare these two files based on these fields, if I my first file first record does not match with second file first record, I need to insert ' " at end of the first record of the first file and if it matches I want insert 'X' to first file record and I want to write all the matched and unmatched records to output file from the only first input file only.
both file length are same like..150
first filed from 2 to 8
second field 15 to 22
third filed is from 34 to 41
pld help on this...it is an urgent. Thanks in advance. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
What is unclear about what I described against what you want? Did you look through the link provided?
I could be run over, involved in a dramatic shoot-out, or sit on my router at any moment. What would you do then?
Unless you want to pay, you have to get down to it. If you get stuck, show what you've done and what problem you had. |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
If its small enough record length, you could PUSH records to next one and treat them like any other compare you would run through DFSort.
Quote: |
I could be run over, involved in a dramatic shoot-out, or sit on my router at any moment. What would you do then? |
Bill, I hope you are ok after dramatic post |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
sqlcode1 wrote: |
If its small enough record length, you could PUSH records to next one and treat them like any other compare you would run through DFSort. |
There's an example of that in the post I linked to as well. |
|
Back to top |
|
|
|