Posted: Fri May 21, 2004 3:46 am Post subject: Sort Problem
Hi,
I need to use only syncsort to acheive the solution for the given below problem in a single step.
Problem: My input file is of length 3123. I need to create 2 output file.
Requirement: Input file have 16 digit Policy number, 10 digit date & Flag(which can have 'F' or 'A') and the condition is if the duplicate Policy comes with different date then I have to keep the Oldest date record.
Output 1) Only one field. i.e Unique Policy Number (Policy only which comes with Flag 'F")
Output 2) all records...Sorted on the basis of policy and date fields... Without any duplicate...(i.e. it might happen that more than 1 record comes with same policy with everything same except the date , then in that case i have to keep the oldest date)
I tried out with following control card but its not giving the desire result:
First of all, there is a correction, the input file is of 3123 and I mentioned 80 in the control card.
Sample Input:
+----4----+----5----+----6----+----7----+----8 ----124----
5106A 777802 A451010001222003-01-10 F
5106A 777802 A451010001222003-01-11 F
5106A 888786 A451010001182003-01-10 A
5106A 888786 A451010001182003-01-19 A
Output 1)
----+----1----+-
5106A 777802
Output 2)
+----4----+----5----+----6----+----7----+----8 ----124----
5106A 777802 A451010001222003-01-10 F
5106A 888786 A451010001182003-01-10 A
First of all, there is a correction, the input file is of 3123 and I mentioned 80 in the control card.
Sample Input:
Column (starting from 35)
Code:
+----4----+----5----+----6----+----7----+----8.........---124----
5106A 777802 A451010001222003-01-10................ F
5106A 777802 A451010001222003-01-11................ F
5106A 888786 A451010001182003-01-10................ A
5106A 888786 A451010001182003-01-19................ A
Output 1:
Code:
----+----1----+-
5106A 777802
Output 2:
Code:
+----4----+----5----+----6----+----7----+----8-----.....--124----
5106A 777802 A451010001222003-01-10................ F
5106A 888786 A451010001182003-01-10................ A
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Fri May 21, 2004 5:51 am Post subject:
Rahul,
If I understand correctly your Policy number starts from pos 35 for 16 bytes and your date is in position 63 for 10 bytes and your flag indicator is in pos 124? If this assumption correct, then the following job will give you the desired results.
First output is as per my requirement.
But second output keep the policy which comes first in order. I want the policy with oldest date. How do i use the data feild in above card.
Any suggestion??
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum