This works, but not in the way described. The file does not get purged
and rebuilt. The way the CI purges a file is to open it and then close it
with a disposition of purge. The file command's SAVE option overrides
that disposition. The same file still exists, but it is empty because the CI's
FOPEN also opened it with ACC=OUT, which sets the EOF to the
beginning of the file. If you add ACC=IN to the file command, the file will
be unchanged.
>>> John Zoltak <[log in to unmask]> 01/22/98 08:41am >>>
Greg,
How about this.
:File Purge=<KSAMXL FILE>,OLD;SAVE
:Purge *Purge
This will purge the old file and save a new empty file with the
same specs.
Hope this is what you want.
John Zoltak
> -----Original Message-----
> From: Stigers, Greg ~ AND [SMTP:[log in to unmask]]
> Sent: Thursday, January 22, 1998 10:30 AM
> To: [log in to unmask]
> Subject: [HP3000-L] Emptying an NM KSAM file
>
> I have an NM KSAM file that contains records, and I now want it to be
> empty. I know that I could write a COBOL program to OPEN it OUTPUT,
> and
> voila! I would now have an empty file. I could also purge or rename
> it,
> and rebuild it, but sure as I do that, someone will need to change a
> key
> or a field, and then the BUILD would have to be maintained. I would
> prefer to find another, sure way to do this that is less prone to
> human
> error. I don't see where SuprTool can do this for me, nor did I see
> anything searching MPEX. The best way I came up with was to rename
the
> original, then FCopy it to the original name, and use FCOPY
> FROM=OLDFILE;TO=(NEWFILE);NEW;SUBSET="",1,EXCLUDE
> to "clone" this file. I * think * that has the disadvantage of reading
> all of the records in the source file to exclude them. I would like a
> better approach, if there is one.
|