HP3000-L Archives

January 1998, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Michael D. Hensley" <[log in to unmask]>
Reply To:
Date:
Thu, 22 Jan 1998 09:32:05 +0000
Content-Type:
text/plain
Parts/Attachments:
text/plain (37 lines)
> 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.

The %ERASE command in MPEX works just fine on NM KSAM files, although they
don't mention it in the manual/online help (when I was writing the
documentation, I wouldn't have missed something this obvious... well, maybe I
would have...).

Oh, and for non-MPEX users, no need to write a COBOL (or any other language)
program.  Try this command file:

anyparm filetoerase
file erasefil=!filetoerase;save
purge *erasefil
reset erasefil
listf !filetoerase,2

It works with flat files and NM KSAM files.  For CM KSAM files, use the ERASE
command in KSAMUTIL (modifying the above command file to check for CM KSAM
files and handle the correctly is left as an exercise for the bored).

---
Michael D. Hensley   | mailto:[log in to unmask]
Allegro Consultants  | http://www.allegro.com
650/369-2303

ATOM RSS1 RSS2