From:	MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX" 12-JUL-1992 16:42:01.74
To:	info-vax@kl.sri.com
CC:	
Subj:	Re: Program to "rewind" file versions to ;1 ... the saga continues

JRW@PSL.WISC.EDU ("Jim Winkle, UW-PSL, 608-873-6651") writes:
|> >      Hi.  Does anyone have a program (preferrably in DCL) that
|> > will "rewind" file versions back to version 1 for all files on a disk?

God told me to do it ... You can sell it, copy it, whatever; just don't tell
anyone that I wrote it.

$!
$ the_file = P1
$ if f$search(the_file) .eqs. ""
$then
$	write sys$output "Eh?"
$	exit
$endif
$!
$ the_file = f$search(the_file) - f$parse(f$search(the_file),,,"VERSION")
$ high_version = f$parse(f$search(the_file + ";"),,,"VERSION") - ";"
$ low_version = f$parse(f$search(the_file + ";-0"),,,"VERSION") - ";"
$ count = f$integer(high_version) - f$integer(low_version)
$ if count .eq. 0
$then
$	rename 'the_file' 'the_file';1
$	exit
$endif
$ version = 1
$!
$loop:
$ this_version = the_file + ";-''f$string(count)'"
$ new_name     = the_file + ";''f$string(version)'"
$ if f$search(this_version) .nes. ""
$then
$	if f$search(this_version) .nes. f$search(new_name) then -
		rename/new_version 'this_version' 'the_file';'version'
$	version = version + 1
$endif
$ count = count - 1
$ if count .ne. 0 then $ goto loop
$!
$the_end:
$ rename/new_version 'the_file' 'the_file';-1

-- 
 Phone: +44 71 528 8282  E-mail: nreadwin@micrognosis.co.uk
 Anything is a cause for sorrow that my mind or body has made

