Hi,
I have a requirement wherein i have to extract records like the below
ey is first 17 bytes
I have to extract records based on first 17 bytes and next one byte ( Rec Disposition )
Case I
If the first 17 bytes are unequal , then keep the record disposition 6 in the output file
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
DXZBA30GX400057478000217E
DXZBA30GX400098006000217N --> Keep this record
DXZBA30GX400098628000217E
Case II
Remove the record type = 6 (as below)
If there are records with first 17 bytes equal and having record disposition of 6 and 8
then delete the type 6 and keep the type 8
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
DXZBA30GX550835018000217E
DXZBA30GX550836896000217N --> Delete this record
DXZBA30GX550836898000217E --> Keep this record
DXZBA30GX550836928000217E
Case III
Remove the Record Disposition = 6 and next Record Disposition = 8(as below)..
Keep the last record with the disposition 8
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
DXZBA30GX551116228000217E
DXZBA30GX551216336000217N --> Delete this record
DXZBA30GX551216338000217E --> Delete this record
DXZBA30GX551216338000217E --> Keep this record
DXZBA30GX551117208000217E
Need help
if anyone can help then it would be great
now all the 3 keys are different and how come you only picked the first and 2nd record? 2nd record has a 6 and that explains as to why you picked it , but how about DXZBA30GX40009862 key? Why did it get dropped? You need to do a better job of explaining the rules.
i am sorry..the "--> Keep this record " AND "--> Delete this record" are given for the duplicate ones except for the CASE I..
so, in CASE I , the output will be all the 3 records
DXZBA30GX400057478000217E
DXZBA30GX400098006000217N --> Keep this record
DXZBA30GX400098628000217E
in CASE II
DXZBA30GX550835018000217E
DXZBA30GX550836898000217E --> Keep this record
DXZBA30GX550836928000217E
in CASE III
DXZBA30GX551116228000217E
DXZBA30GX551216338000217E --> Keep this record
DXZBA30GX551117208000217E
I am sorry again for the confusion..can you now tell me how it can be done via sort ?