Page 1 of 1

How to overwrite seqfile through basic command.

Posted: Thu Sep 21, 2006 1:25 am
by hhh
Hello,

While using following command in our routine
OpenSeq PathName To FileVar Else ; * Open the sequential file or if not exist then create seq file
CREATE FileVar ELSE ABORT

,If file already exists and we want to overwrite our data so we can not able to overwrite the i/p data on particular file with this command.

what is the way to overwrite file if it is already existed.

Pl suggest your ideas on same.

regards,
Hiten

Posted: Thu Sep 21, 2006 2:15 am
by ray.wurlod
Search the forum for a routine called OpenSequentialFile and use that. It handles all possibilities.

The actual statement you require is WEOFSEQ, but there are other possibilities you haven't even thought about thus far.

Posted: Thu Sep 21, 2006 4:35 am
by maheshsada
you can use the status function to check the how the Openseq was executed based on which you can overwrite the seq file

the possible return values are 0 - successful, 1 - failed to open

Posted: Thu Sep 21, 2006 5:05 am
by ray.wurlod
What about where the file does not exist, but is nonetheless opened for writing? What about where there exists a record level lock on the file taken by another process? As I said, there are very many possibilities, which is why the OpenSequentialFile routine exists.