I have two files of record lengths 9 and 4500, I want to check if the 9 character field in file1 is present in file2 at position 1600 of the second file
I want the unmatched value from file 2 only to be written to another file. The values in file 1 are unique whereas the values in file1 can be duplicates. It doesnt work. Please help
I am trying to write values present in F1 alone to one file, F2 alone to another file and both files to another file. I am using the above sort card. I am getting the error as
ICE414A 0 SORTJNF1 (F1) KEY FIELD END AT 1608 IS BEYOND LENGTH OF 9
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
You really should be able to fix that yourself without asking. The message is explicit, and the 9 must mean something to you.
I've changed the third OUTFIL to use SAVE, which means "put on this OUTFIL all records which do not appear on another OUTFIL".
I've changed the 11,9 on that OUTFIL to 10,9, assuming that you want the full information, not the last eight bytes plus the match marker.
On that OUTFIL, other than looking at odd/even "line number", you have no clue as to which is from what input. However, since they should be the same, it shouldn't matter, and perhaps you only need to output one of them :-)
My badf and apologies for not seeing at the issue myself. This works now.
Another question pertaining to the same, since there are duplicates present at the 4500 length file I am getting the duplicates in the "BOTH" file. Is there a way that I can get the duplicates removed and just get the count of how many times each are repeated.Kindly help
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Yes, if you look at OUTFIL in the manual, specifically SECTIONS, TRAILER3, COUNT. If you use REMOVECC and NODETAIL you should get what I think you want. If you don't, show the sample input, and expected output, and what you have tried.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
If you just need the keys why bother reading the entire 1600 byte F1 record? use JNF1 and JNF2 to read only the fields you interested.
As you mentioned that you have duplicates in BOTH file, I am assuming that you also might have duplicates on the non matching keys. Use the following control cards that will remove duplicates in ALL the files and give you the desired results.
This is the code that I used to get the result. Please advise if there is something more that can be done in the code to improve efficiency
huh?
Why are you using sections for 1,2? when your key has a length of 9 bytes? And the count you get is totally wrong.
Lets say you 10 duplicates for a key in file1 and the same key have 20 duplicates in file2, then join keys would have produced 10 X 20 = 200 records for that key. With your job you might get 200 as count which is totally wrong. You need to better understand what joinkeys does