Page 1 of 1

Need to find duplicate records in JCL

PostPosted: Wed Jan 21, 2015 5:27 pm
by vishnusrini
I have a file which looks like this.

File1
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000001 SANDIPXXXXXXXXXXXX02XXXXXXXXXXXXXXXXX
000002 SANDIPXXXXXXXXXXXX01XXXXXXXXXXXXXXXXX
000003 SUDHASXXXXXXXXXXXX01XXXXXXXXXXXXXXXXX
000004 TANIYAXXXXXXXXXXXX03XXXXXXXXXXXXXXXXX
000005 TANIYAXXXXXXXXXXXX03XXXXXXXXXXXXXXXXX
000006 VISHNUXXXXXXXXXXXX01XXXXXXXXXXXXXXXXX
000007 VISHNUXXXXXXXXXXXX01XXXXXXXXXXXXXXXXX
****** **************************** Bottom of Data ****************************

From this file I need to find the duplicate record and the key is from 1 of 6 char (i.e. 1-6)
And I want to check whether in the selected duplicate records the value in clos 19-20 (2 char) is same or not.

Output1
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000004 TANIYAXXXXXXXXXXXX03XXXXXXXXXXXXXXXXX
000005 TANIYAXXXXXXXXXXXX03XXXXXXXXXXXXXXXXX
000006 VISHNUXXXXXXXXXXXX01XXXXXXXXXXXXXXXXX
000007 VISHNUXXXXXXXXXXXX01XXXXXXXXXXXXXXXXX
****** **************************** Bottom of Data ****************************

If you see, there are the occurance of sandip in the input file, but the value in 19-20 is differenct, so i dont whan this file. this file should be moved to other output file

Output2
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000001 SANDIPXXXXXXXXXXXX02XXXXXXXXXXXXXXXXX
000002 SANDIPXXXXXXXXXXXX01XXXXXXXXXXXXXXXXX
****** **************************** Bottom of Data ****************************

Some one help me to do this process in JCL.

Re: Need to find duplicate records in JCL

PostPosted: Wed Jan 21, 2015 5:52 pm
by BillyBoyo
Can there only be two records with duplicate keys, or can there be more?

Re: Need to find duplicate records in JCL

PostPosted: Wed Jan 21, 2015 6:31 pm
by vishnusrini
There are possible to have more duplicate records, i.e. more then 2 duplicate records.

Re: Need to find duplicate records in JCL

PostPosted: Wed Jan 21, 2015 8:06 pm
by Terry Heinze
vishnusrini,
In the future, please use Code tags. You can read about them by clicking on the BBCode link in FAQ. Code tags are available when clicking Post a Reply but not Quick Reply.
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000001 SANDIPXXXXXXXXXXXX02XXXXXXXXXXXXXXXXX
000002 SANDIPXXXXXXXXXXXX01XXXXXXXXXXXXXXXXX
000003 SUDHASXXXXXXXXXXXX01XXXXXXXXXXXXXXXXX
000004 TANIYAXXXXXXXXXXXX03XXXXXXXXXXXXXXXXX
000005 TANIYAXXXXXXXXXXXX03XXXXXXXXXXXXXXXXX
000006 VISHNUXXXXXXXXXXXX01XXXXXXXXXXXXXXXXX
000007 VISHNUXXXXXXXXXXXX01XXXXXXXXXXXXXXXXX
****** **************************** Bottom of Data ****************************


Re: Need to find duplicate records in JCL

PostPosted: Wed Jan 21, 2015 8:39 pm
by vishnusrini
Sure, in future i will post using Code tags.

Re: Need to find duplicate records in JCL

PostPosted: Thu Jan 22, 2015 3:49 pm
by vishnusrini
Do any one know the solution for my issue, please advice me.

Re: Need to find duplicate records in JCL

PostPosted: Thu Jan 22, 2015 5:56 pm
by BillyBoyo
You need a better description and sample data which is representative of your actual possible data, showing the records with more than two being duplicate and with and without the different values. Can some values be the same within a key, and others different, for instance. If so, what then?

Re: Need to find duplicate records in JCL

PostPosted: Fri Jan 23, 2015 3:17 am
by NicC
Please learn to post in the correct part of the forum. JCL cannot do anything with data - it simply telss the OS what program(s) you want to execute and the resources required. If you were wanting a sort solution then please state this and which sort product you use so that the topic can be moved to the correct part of the forum.