hi,
i am looking for a solution to pass two set of output records in the transformer to a sequential file for a single incoming record under certain conditions.
i have customerno, accountno and a key coming from the input link. if the key is same for two customerno, i have to log an error which contains the columns: customerno, accountno and key. so, whenever a duplicate record is located using stage variables, i want to write the old customerno and the new customerno with the same key as separate records to the error file along with their curresponding accountno and key.
transformer-2 set of records in o/p link for one i/p record
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 437
- Joined: Fri Oct 15, 2004 6:13 am
- Location: Pune, India
Re: transformer-2 set of records in o/p link for one i/p rec
Earlier, I have done the same thing, but in my case I had just sent the second duplicate record to the reject file.Roshni wrote:so, whenever a duplicate record is located using stage variables, i want to write the old customerno and the new customerno with the same key as separate records to the error file along with their curresponding accountno and key.
To achieve your requirement, you may have to retain the previous row in stage variables. The logic that I can think of is something like follows:
Define 4 stagevars as 3 for input cols and one as dupl flag.
The derivations will be as follows:
SVarCustNo:
Code: Select all
If Link.Key = SVarKey Then
SVarCustNo
Else
Link.CustNo
Code: Select all
If Link.Key = SVarKey Then
SVarAccNo
Else
Link.AccNo
Code: Select all
If Link.Key <> SVarKey Then
'N'
Else
If SVarDupl = 'Y' Or SVarDupl = 'A' Then
'A'
Else
'Y'
Code: Select all
Link.SVarKey
Code: Select all
SVarDupl = 'Y' Or SVarDupl = 'A'
Code: Select all
SVarDupl = 'Y'
Now as we have 2 file, call Afterjob subroutine DSExecute to sort and merge these 2 files on KEY column so that output of this will one concatenated Reject file.
There may be some better alternative way to achieve this, but I would have done this as aforesaid.
Hope this helps.
Regards,
S. Kirtikumar.
S. Kirtikumar.
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom