Rouitne to create the file in appending mode
Posted: Thu Sep 03, 2009 5:29 am
Hello,
I have created a transform routine as shown below. It actually restructures the incoming data and creates the file & writes the data in append mode. Routines is behaving as I am exepcting but the issue with this I have to touch the files first (I have to get the zero byte first file created).
What I'm a expecting is , Routine it self should create the file & write the data in appending mode to it.
Since I am getting the 'N' number of files with different set metadata defined in the them, I am following this approach.
Could anybody of you help me on this.
Thank you,
I have created a transform routine as shown below. It actually restructures the incoming data and creates the file & writes the data in append mode. Routines is behaving as I am exepcting but the issue with this I have to touch the files first (I have to get the zero byte first file created).
What I'm a expecting is , Routine it self should create the file & write the data in appending mode to it.
Since I am getting the 'N' number of files with different set metadata defined in the them, I am following this approach.
Code: Select all
FileDir= '/Wrkdir/data'
FileName="xxx_unspecified.dat"
ColCnt=count(ColName,",")+1
IF Rownum>0 Then
*** Write To File
PathName = FileDir:'/':FileName
OpenSeq PathName To FileVar Then
SEEK FileVar,4,2
ELSE
Call DSLogWarn("Error in SEEK", RoutineName)
END
For i=1 to ColCnt
Column_Name=Field(ColName,',',i)
Column_Value=Field(ColValue,',',i)
FileFormat=File:'|':i:'|':Column_Name:'|':Column_Value:'|':Rownum
WRITESEQ FileFormat TO FileVar Then
END
NEXT i
END
Ans=FileFormat
weofseq FileVar
CloseSeq FileVar
End
Thank you,