Write the names to a circular file with just enough room for three records.
When done, this file will only contain the last three file names:


   %BUILD LAST3;REC=-80,3,F,ASCII;DISC=3;CIR
   %FILE O=LAST3,OLD;ACC=OUT
   %LISTF FILE###+FILE???,6;*O
   %REPEAT
   %  YESPURGE ![R]
   %FORRECS R=LAST3,OLD


"Larry Barnes" <[log in to unmask]> wrote in message
news:3dbebb70$3@skycache-news.fidnet.com...
> Try:
>
> PURGE FILE0##
> PURGE FILEA##
>
> -----Original Message-----
> From: Johnson, Tracy [mailto:[log in to unmask]]
> Sent: Tuesday, October 29, 2002 8:38 AM
> To: [log in to unmask]
> Subject: [HP3000-L] Deleting All But The Last n Names in a Fileset
>
>
> I'm looking for an elegant way to PURGE all
> but the last 'n' files in a fileset?
>
> FILE001  <---- want to purge this.
> FILE002  <---- want to purge this.
> FILE003  <---- want to purge this.
> FILE010  <---- want to purge this.
> FILEA00  <---- want to purge this.
> FILEXYZ  <---- want to keep this.
> FILEXZZ  <---- want to keep this.
> FILEZZZ  <---- want to keep this.
>
>
> I know I could read a LISTF into a file and
> manipulate the filenames into a JOB stream
> for PURGEing.  (It just doesn't seem elegant.)
>
> MPEX is available.
>
> BT
> NNNN
> Tracy Johnson
> MSI Schaevitz Sensors
>
> * To join/leave the list, search archives, change list settings, *
> * etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
>
> * To join/leave the list, search archives, change list settings, *
> * etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
>

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *