View previous topic :: View next topic
|
Author |
Message |
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi,
Have a file with duplicate records (LRECL=800, RECFM=FB).
Input:
Code: |
----+----1----+----2----+----3
RECORD1 ABC KEY-0102
RECORD1 ABC KEY-0102
RECORD1 ABC KEY-0101
RECORD2 ABC KEY-0102
RECORD1 ABC KEY-0000
RECORD2 ABC KEY-0102
RECORD2 ABC KEY-0102
|
There are two sets of duplicates in the above file (1st & 2nd are 1st set and 4th, 6th and 7th are 2nd set).
My expected output should contain each duplicate and count of duplicate records alongside at 805th column.
Output:
Code: |
----+----1----+----2----+----3.....................................8----+
RECORD1 ABC KEY-0102 2
RECORD2 ABC KEY-0102 3
|
I have tried to use OUTFIL with SECTIONS and TRAILER3 but due to 256 bytes limitation on SECTIONS the job would fail with U00016
Please help.
Thanks. |
|
Back to top |
|
|
Ronald Burr
Active User
Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
Do you consider "duplicate records" to mean duplicate for the entire 800 bytes? or just duplicate for the 20-byte "key" (as shown in your example)? |
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Yes, duplicate for entire length of 800 bytes
Thx. |
|
Back to top |
|
|
Ronald Burr
Active User
Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
Hopefully, you don't have more than a few hundred records, otherwise you will burn up LOTS and LOTS of CPU - but the below should work (untested).
Code: |
INREC FIELDS=(1,800,C'00001')
SORT FIELDS=(1,800,CH,A)
SUM FIELDS=(801,5,ZD)
OUTFIL FILES=OUT,INCLUDE=(801,5,ZD,GT,00001) |
|
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Thanks a lot |
|
Back to top |
|
|
|