"Johnson, Tracy" wrote:
> I want to discard all but the last three, and the date stamps
> of the files may vary, because these are RESTOREd files in
> test groups, not production data.
i don't see that you have any choice but to run a listfile,6 out to a file....but
that's ok.
with your listfile in a file, examine the number of record (setvar n =
finfo('myfile','eof') and subtract three from that number (setvar x = n - 3).
(it's probably prudent to check that 'n' is >= 3, btw). now you know how many
files you want to purge.
do a print of your listfile file (i called it 'mydata' above) with the following
syntax:
print myfile;end=x > myfile2
myfile2 will contain the names of all your files less the last three.
from there, all that you need is a while loop to read thru myfile2. as you read in
a record, stick a 'purge ' in front of it and do it. (it's probably prudent to add
some error checking, btw).
i broke the above out into a lot of extra steps for clarity. for instance, 'x'
doesn't have to be literally computed -- but it makes the explaining easier. and
build your script in steps...and test as you go.
hth - d
--
Donna Garverick Sr. System Programmer
925-210-6631 [log in to unmask]
Come, my friends, 'Tis not too late to seek a newer world.
Tho' much is taken, much abides; and tho'
We are not now that strength which in old days
Moved earth and heaven, that which we are, we are.
"Ulysses", A. Tennyson
>>>MY opinions, not Longs Drug Stores'<<<
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|