Posted: Tue Mar 07, 2006 4:33 pm Post subject: frm 2 files based on key match apnd clm values : SORT
Hi All,
I am with two files.
If the key in fileA matches with the key in fileB, I need to append the Field-BX data to Field-AX data using Syncsort( as the shop over here supports only Syncsort).
i.e.
FileA
Code:
ID Name Numb
1234 abc 1
1235 xyz 2
1236 uvw 1
1238 opq 5
FileB
Code:
ID Name Numb
1234 abc 4
1236 uvw 4
1236 uvw 5
output file: (FileC)
Code:
ID Name Numb
1234 abc 14
1235 xyz 2
1236 uvw 145
1238 opq 5
Can someone please suggest me how to get this result
Note: 1) Record layout of all the three files are same.
2) FileA do not have any duplicates in that, all the records are
unique with the Key i.e. ID in the above example
Please do let me know if I need to give any more details
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Wed Mar 08, 2006 3:57 am Post subject:
Ram,
There are lots of posts already in this forum which addresses similar queries. I would have appreciated if you had spent sometime reading thro' these posts.
I did a search and looked in to the links, before posting. I could find the links while looking Nag's post "combine two files with different fields as 1 record" (feb 10 2006)
But, I am very low in Sort and could not convert these technics for Syncsort, as the shop over here supports only Syncsort.
If possible can you please help me out with Syncsort.
Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Wed Mar 08, 2006 10:39 am Post subject:
Ram22,
Answer ALL of the questions
1. What is the max no: of dups for each key in file B?
2. what is the LRECL and RECFM of both input and output files
3. What is the pos and format of the fields which needs to merged and compared?
4. What version of syncsort do you have. run a sample job and look at the first line in your sysout.
Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Fri Mar 10, 2006 9:59 am Post subject:
The following job will give you the desired results. A brief explanation of the job.
In step0100 we take input file with dups and create a seqnum for every record and then based on the seqnum we move the corresponding value as an array of bytes. Since you said you can have a max of 5 dups for each key we need to arrange them as an array of 5 bytes.
Its really a wonderful sort. But I am a basic user of Sort. I tried to understand first step of handling the file with duplicates, but believe me it is very complex for me to understand.
Can you please explain me in details. Please note that these details will make to enjoy the beauty of this Sort you drafted.
I just want to add one more clarification in answering one of your questions
3. What is the pos and format of the fields which needs to merged and compared?
Pos: 18 and length is 5 & Format : Alphanumeric ( X(05) )
To be more clear , In my input files:
Fields need to be merged start in postion 18 and length is 5.
Fields need to be compared i.e. key position is 1,17,ch
I think in the example you gave
OUTREC FIELDS=(1,17,18,1,18,1,18,1,18,1,18,1,80:X,SEQNUM,8,ZD,8X)
1,17 means the key and I could not understand the remaing part 18,1....
Once we have this type of record then we can use to join with your unique file1.
There is small PDF which comes along with syncsort titled " exploiting Syncsort Join" which in detail explains the join process with examples. read it.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum