I have a file with 4 fields. Few of the records has 3 fields matching but the last field has different value ( 101 and 102). If we take first three fields these records are duplicates. If they are duplicate, i want to filter only records has 102 as 4th field. If they are not duplicate, we need to filter those records as well. The file is not in sorted order. Please help me how to handle this in sort.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
prabusmd wrote:
All,
I have a file with 4 fields. Few of the records has 3 fields matching but the last field has different value ( 101 and 102). If we take first three fields these records are duplicates. If they are duplicate, i want to filter only records has 102 as 4th field. If they are not duplicate, we need to filter those records as well. The file is not in sorted order. Please help me how to handle this in sort.
Please post sample data along with LRECL , RECFM, Position, Format and length of the fields involved.
LRECL : 51
File format : FB
Fields:
05 :PFX:-DETAIL-REC.
10 Field A PIC X(01).
88 A1 VALUE '0'.
88 A2 VALUE '1'.
88 A3 VALUE '9'.
10 Field B PIC 9(18).
10 Field C PIC X(03).
10 Field D PIC 9(05).
10 Field E PIC X(03).
10 Field F PIC X(02).
10 FILLER PIC X(19).
We need to filter the records with field C = 101 when D = 00100 ( mean time Field A, Field B, Field D should be same - duplicates). If D is different, we need to have those records. Only if D = 00100 we have this duplicate issue.
File example :
1000000000010002201101001007XA1 - need this in o/p file
1000000000010002201102001007XA1 - Remove it
1000000000010002601101001007XA1 - need this in o/p file
1000000000010002401102001007XA1 - need this in o/p 1000000000010002601102001007XA1 - Remove it
1000000000010002541102007007XA1 - need to have in o/p file
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
prabhusmd,
Use the following DFSORT JCL. I assumed that if you have a record with FIELD C= '101' AND FIELD D = '00100', then remove all the duplicates for that key value at pos 2 for 18 bytes.