Hi
I am writing to a Seq File from After Job routine using WRITESEQ. By nature this command start writing from the starting of the file pointer. Since OpenSeq opens a file with the pointer at the begining it always overwrite the existing data.
My requirement is, I want to add new rows to the existing file with its data intact. Please help .
Regards
Rubu
Adding A line to Existing File From BASIC Routine
Moderators: chulett, rschirm, roy
Rubu,
the file pointer needs to be set to the EOF so that you can append to a sequential file. If your file pointer is MySeqFilePtr (i.e. OPENSEQ '/tmp/hello.txt' TO MySeqFilePtr THEN ... ELSE ...) then executing the command will position the pointer to the end of file (the first parameter, 0, is the number of bytes offset and the 2nd parameter value of 2 tells that this position is relative to the end-of-file, see 6-522 of the Basic Manual for details).
I am not 100% sure that the sequential file is actually closed when you enter the after-job routine; but you will find out soon enough when you test this solution.
the file pointer needs to be set to the EOF so that you can append to a sequential file. If your file pointer is MySeqFilePtr (i.e. OPENSEQ '/tmp/hello.txt' TO MySeqFilePtr THEN ... ELSE ...) then executing the command
Code: Select all
SEEK MySeqFilePtr, 0, 2 THEN ... ELSE ...
I am not 100% sure that the sequential file is actually closed when you enter the after-job routine; but you will find out soon enough when you test this solution.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Craig - thanks for the info :D It's always good to get positive confirmation
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>