R1TEST1 NARA HOME
R2TEST1 NARA HOME
R2AMER1 NARA MOVIE
R2AMER2 RAJE NMTCH
R2TEST1 AMAR NMTCH
I have 2 input files of same length - 20 bytes. Field1 ( File 1, position 3 onwards for 5 bytes ) have to be compared with Field1 ( file 2, position 1 onwards for 5 bytes ). If they match, i want the field2 ( file 1, position 10 onwards for 4 bytes ) have to be matched with field 2 ( file 2, position 12 onwards for 4 bytes ). If i have a perfect match, i willl update the output file with last 5 bytes of output file, with contents of file 2.
output will have 1-15 contents copied from file 1. 16-20 contents from file 2. If there is match on field1 and field2, 16-20 should contain contents from file 2, otherwise it should contains the letters 'NMTCH'.
I have been reading the manuals, and i am kind of confused with sort keys. Especially since key is not unique here. i tried coding with sequence number. Is this even possible to code wih syncsort or icetool? Or should i code using programs instead?
why to make it difficult? you have to add these two fields (what you explained above) in the JOINKEYS then reformat fields as per what you want once you have that then make a use of parameter marker (?) to set NMATCH by using IFTHEN WHEN in the OUTREC
The keys are the things you are going to match on. Multiple key elements give you one logical key. If your logical keys can be duplicate, on one file or both, then you need some code in SORT to deal with that. There's a question form last week or so, perhaps in the DFSORT part of the forum, which goes into this. It is not difficult.