I have the following dataset:
900012 10102020 XXXXXXXX
900012 10102020 YYYYYYYY
900012 10001171 ZZZZZZZZ
900012 10001665 AAAAAAA
900012 10003388 BBBBBBB
900012 10004081 CCCCCCC
900012 10004081 DDDDDDD
900012 10004081 EFGHSKS
900012 10010182 EEEEEEEE
900012 10022113 FFFFFFFF
900012 10032859 GGGGGG
900012 10034707 HHHHHH
900012 10035022 MNONON
900012 10039532 ABCDEFG
900012 10039532 ABEDGED
900012 10102020 YYYYYYYY
900012 10001171 ZZZZZZZZ
900012 10001665 AAAAAAA
900012 10003388 BBBBBBB
900012 10004081 CCCCCCC
900012 10004081 DDDDDDD
900012 10004081 EFGHSKS
900012 10010182 EEEEEEEE
900012 10022113 FFFFFFFF
900012 10032859 GGGGGG
900012 10034707 HHHHHH
900012 10035022 MNONON
900012 10039532 ABCDEFG
900012 10039532 ABEDGED
Dataset characteristics are RECFM=FB LRECL=1117
Position 1 - 6 = identifier
Position 8 -16 = Account no
Position 19 - 1117 = other data
I'd like to count instances of Account no, and add that counter to the data, but show each count increment e.g.
Result is:
900012 10102020 1 XXXXXXXX
900012 10102020 2 YYYYYYYY
900012 10001171 1 ZZZZZZZZ
900012 10001665 1 AAAAAAA
900012 10003388 1 BBBBBBB
900012 10004081 1 CCCCCCC
900012 10004081 2 DDDDDDD
900012 10004081 3 EFGHSKS
900012 10010182 1 EEEEEEEE
900012 10022113 1 FFFFFFFF
900012 10032859 1 GGGGGG
900012 10034707 1 HHHHHH
900012 10035022 1 MNONON
900012 10039532 1 ABCDEFG
900012 10039532 2 ABEDGED
900012 10102020 2 YYYYYYYY
900012 10001171 1 ZZZZZZZZ
900012 10001665 1 AAAAAAA
900012 10003388 1 BBBBBBB
900012 10004081 1 CCCCCCC
900012 10004081 2 DDDDDDD
900012 10004081 3 EFGHSKS
900012 10010182 1 EEEEEEEE
900012 10022113 1 FFFFFFFF
900012 10032859 1 GGGGGG
900012 10034707 1 HHHHHH
900012 10035022 1 MNONON
900012 10039532 1 ABCDEFG
900012 10039532 2 ABEDGED
When I have the result, I only want to keep Account Numbers that have a count > 1, including the originals e.g
Output I would like is:
900012 10102020 1 XXXXXXXX
900012 10102020 2 YYYYYYYY
900012 10004081 1 CCCCCCC
900012 10004081 2 DDDDDDD
900012 10004081 3 EFGHSKS
900012 10039532 1 ABCDEFG
900012 10039532 2 ABEDGED
900012 10102020 2 YYYYYYYY
900012 10004081 1 CCCCCCC
900012 10004081 2 DDDDDDD
900012 10004081 3 EFGHSKS
900012 10039532 1 ABCDEFG
900012 10039532 2 ABEDGED
Is it possible to do this using DFSORT/ICETOOL?
I'd be very grateful for any help. The data in Positions 9 to 1119 needs to be retained for the records that are being kept
Coded for you this time