File1 is having duplicate User IDs(starting position 5 length 5) I need to compare the user id field of file 1 with the user id field of file 2 (starting position 5, length 5), File2 is having no duplicates,
if the user id matches then the complete record from file 1 has to be written to the output file.
Layout of file1: (It has user id from starting position 5 and length 5, the user id field has duplicates but no two rows are same.)
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000001 900 AA4UT ALMA ALEJANDRE 3363 ACUNA LAMP PLANT 3363 21101
000002 740 AA4UT ALMA ALEJANDRE 3500 SPECIAL PACK, INC. 3500 50027
000003 709 AC3UT CHOJNACKA, ANITA 3365 OAKVILLE LAMP PLANT MULT 21100
000004 740 AC9UT AMY CONDON 3500 SPECIAL PACK, INC. 3500 50027
000005 914 AECUT ALAN CHAPMAN 3174 C.E.N MULT 21100
Layout of filel 2 (no duplicates in user id field - starting position 5, length 5)
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000001 AA4UT
000002 AC3UT
000003 CP7UT
000004 DH4UT
000005 DPSUT
Desired output:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000001 900 AA4UT ALMA ALEJANDRE 3363 ACUNA LAMP PLANT 3363 21101
000002 740 AA4UT ALMA ALEJANDRE 3500 SPECIAL PACK, INC. 3500 50027
000003 709 AC3UT CHOJNACKA, ANITA 3365 OAKVILLE LAMP PLANT MULT 21100
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
I can vaguely recall a similar problem in the dark and distant past, and for some reason when I changed the input order of the files the results were as required.
I suggest that you try the same, by changing your CONCAT DD to read FILE2 before FILE1.
I am getting the desired result with the above mentioned example.
file 2:
But with the following example its not working:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000001 AA2UT
000002 AC3UT
000003 CP7UT
000004 DH4UT
000005 DPSUT
File 1
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000001 900 AA4UT ALMA ALEJANDRE 3363 ACUNA LAMP PLANT 3363 21101 101
000002 740 AA4UT ALMA ALEJANDRE 3500 SPECIAL PACK, INC. 3500 50027
000003 709 AC3UT CHOJNACKA, ANITA 3365 OAKVILLE LAMP PLANT MULT 21100
000004 740 AC9UT AMY CONDON 3500 SPECIAL PACK, INC. 3500 50027
000005 914 AECUT ALAN CHAPMAN 3174 C.E.N MULT 21100
the output comes out as :
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000001 740 AA4UT ALMA ALEJANDRE 3500 SPECIAL PACK, INC. 3500 50027
000002 709 AC3UT CHOJNACKA, ANITA 3365 OAKVILLE LAMP PLANT MULT 21100
which is not desired. It should come as:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000001 709 AC3UT CHOJNACKA, ANITA 3365 OAKVILLE LAMP PLANT MULT 21100
as AC3UT is the only user id present in both the files. What should be done to get the desired result.