I see you already have several good responses. That said, I wonder if
you can explain the environment in which you want to do this a bit
more? Why would someone want to clear a file?
When you open a file, of course, there's an option to clear it. (O_TRUNC
in on the open() API, or the 'w' flag on fopen()) Other languages have
similar options. So, normally, an application that wants to start a
file from the beginning will specify these -- you don't normally need to
manually clear them like you would a physical file.
Also, the creation of a physical file requires quite a bit of overhead
since it's a much more complex animal. It needs to create the file's
description, sometimes indexes, etc. There isn't as much overhead with
a stream file -- so it's not an issue to simply delete the file in order
to clear it. You almost never notice any performance problems with
deleting it vs. clearing it. (In fact, from a file sharing perspective
there can be advantages to using delete. If someone currently has the
file open and is reading from it, you can delete it and the OS will let
them keep reading it, it will be removed from the directory, but the
actual data will remain until the program closes it, so it can keep
So in order to make sure you have the best possible answer, we'd need to
understand your scenario. Is this something you're doing interactively
or in a program? Why are you doing it? etc.
On 10/14/2021 7:35 AM, Alan Shore via MIDRANGE-L wrote:
We are on V7r3
Does anyone know of a command and/or process and/or procedure to clear a file in the ifs
I tried a google search, but nothing was found
As an Amazon Associate we earn from qualifying purchases.