Code: Select all
* Read the Sequential file 1st and get the key
PathName="D:\ETL_PROJECTS\GeneralLedger\Data\Source\email_distro.txt"
Ans="Nothin"
openSeq "D:\ETL_PROJECTS\GeneralLedger\Data\Source\email_distro.txt" To FileVar Else
Call DSLogWarn("Cannot open ":PathName, RoutineName)
GoTo ErrorExit
End
OpenSeq "c:\test\Testfff.txt" To writeV then
WeofSeq writeV
end
ReadSeq FileLine From FileVar
On Error
GoTo ErrorExit
End
Then
prevEmailId = Field(FileLine,"|",2)
prevProdKey = Field(FileLine,"|",1)
Ans=prevEmailId
end
concatProdIds=prevProdKey
endOfFileReached=0
Loop
ReadSeq FileLine From FileVar
On Error
GoTo ErrorExit
End
Then
WriteSeq STATUS() to writeV else
Ans=@NULL
end
if (STATUS() = 1) then
endOfFileReached=1
end
else
endOfFileReached=0
EmailId = Field(FileLine,"|",2)
ProdId = Field(FileLine,"|",1)
if (prevEmailId = EmailId) then
concatProdIds = concatProdIds:",":ProdId
Ans=concatProdIds
end
else
val = concatProdIds :"|":prevEmailId
prevEmailId = EmailId
prevProdKey = ProdId
concatProdIds = ProdId
WriteSeq val to writeV else
Ans=@NULL
end
end
end
end
if (endOfFileReached =1 ) then
EXIT
end
UNTIL endOfFileReached=1 REPEAT
ErrorExit:
CloseSeq FileVar
CloseSeq writeV