Empty out a dataset form Natural Program

I want to empty out the work file and then write record in it or overwrite it.Because i need only one record(latest record) in it at any time.
Is there any way to do this. Please help.Thank you!!

Which operating system are we talking of ?

This is the usual outcome. The WRITE WORK statement will cause Natural to open the file in output mode, so the file contents will be overwritten by the new record.

Unless you are using zOS JCL’s DISP=(MOD,… parameter to append new records.

Hint: A more appropriate forum for this post would have been Natural on Mainframes, or Natural on Open Systems, or Natural General.

Are there many applications that will be using the work file?

Will there ever be more than one record in the work file?
If the answer is no, have you considered an Adabas file with one record?
Is the record simply a pointer to the latest record?

Is “latest” based on a date, time, or timestamp field in the record? If so, why not have a field in the file definition called “pointer” which would have the pointer value (no other record in the file would have a value for this field).

In other words, is the work file really necessary, or is it used for other applications that do not use Adabas at all?