Output should be
1111111111AAAAA11111111111111111111111111111111111
4444444444AAAAA44444444444444444444444444444444444
1111111111BBBBB11111111111111111111111111111111111
2222222222BBBBB22222222222222222222222222222222222
3333333333BBBBB33333333333333333333333333333333333
4444444444BBBBB44444444444444444444444444444444444
1111111111CCCCC11111111111111111111111111111111111
3333333333CCCCC33333333333333333333333333333333333
1111111111DDDDD11111111111111111111111111111111111
2222222222DDDDD22222222222222222222222222222222222
3333333333DDDDD33333333333333333333333333333333333
4444444444DDDDD44444444444444444444444444444444444
Which means FILE A is having 4 records with a key AAAAA and 4 records with key CCCCC but FILE B is having only two records with those keys, FileA four records of Key AAAAA and CCCCC needs to be overwritten by FILEB two records of key AAAAA and CCCCC. This count is not fixed....record count may be anything....but File A records of a perticular Key should be overwritten by FILEB records of perticualr Key
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
I think I know what you want to do, but since you used some of the same records in File A and File B (e.g. the first record in each file is exactly the same), it's a bit difficult to verify that. Could you please show an example with different records in FileA and FileB and the output records you expect.
Also, you say for FileA the RECFM=VB and LRECL=5000. What is the RECFM and LRECL for FileB?
What is the approx number of unique keys in FileB? 100, 1000, 5000, more?
think I know what you want to do, but since you used some of the same records in File A and File B (e.g. the first record in each file is exactly the same), it's a bit difficult to verify that. Could you please show an example with different records in FileA and FileB and the output records you expect.
First record or any record data may be same or different..that is why i gave you some generic values as examples, if you need different example that can be like this
Joined: 31 Jan 2008 Posts: 148 Location: Chennai, India
Hi,
I tried the following code with some sample data, also i used the record length as 15 for testing instead 5000 as mentioned by you. The Key position starts from offset 6 and is of length 5. Change the code to have record length of 5000 and test with your sample data.
Let me know how it works.
Input:
Code:
File A
11111aaaaa00100
11111aaaaa00200
11111aaaaa00300
22222bbbbb00400
33333ccccc00500
33333ccccc00600
File B
33333aaaaa00000
44444aaaaa00100
55555ccccc00200
66666ddddd00300
Joined: 31 Jan 2008 Posts: 148 Location: Chennai, India
Hi,
See, i have joined records from both the files based on the key and
reformatted the output file to replace the records in file1 for which there
is a matching record in file 2 based on the key value.Also the output file
contains unpaired records from file1.
I have tested the above code and got the result which i have mentioned
in the output which is