From: CSABA HARANGOZO [csabah@zipworld.com.au] Sent: Tuesday, November 21, 2000 2:37 AM To: Info-VAX@Mvb.Saic.Com Subject: Re: Reset file version number? Netsurfer wrote: > I used to get 5000+ report files (with same filename) with large > version numbers. > Recently adopt a housekeeping policy, but i hate to key in those large > nunbers. Had purged while keeping 1000 versions. > I need to reset them to use a smaller numbers. > Is there a way to do so without system downtime or stopping > application, or renaming the older files? > (Log files need to match the filenames for referrence) > The latest files are in-use most of the time of the day. The little DCL ditty below will resequence file version numbers of a given file. I wrote it a while back, and it is far from perfect. I only did limited testing of it, so be careful. I just manually typed it in, so check for typos also. Caveat emptor ! Use it only at your own responsibility! One could of course embellish it with more error checking, bells and whistles, etc, but it works for me. It will fail on open files, I guess. So it will need modifications in this area. It is a good idea to do a purge first, but it still works quickly on small number of files. ( I only ran interactively so far, but I guess it should work in batch as well, provided the directory specification(s) are right. I think you have to modify part of the "ASK:" segment in this instance, and put in a different check for P1. Also the ERR1 part... The main loop is still OK. ) You don't need to set your default to the directory if you give full specs, [dir]file.ext ( when interactive ). You can name this comfile whatever you wish, I call it RESEQ.COM. I hope this helps... Csaba RESEQ.COM $! This comfile will resequence the version numbers of a given file $! starting from version 1. $! $ VERIFY = F$VERIFY(0) $ ON ERROR THEN GOTO CLEAR $ ON CONTROL_Y THEN GOTO CLEAR $ SAY = "WRITE SYS$OUTPUT" $ KOUNT = 1 $!---------------------------------------------------------------------- $ASK: IF ( P1 .EQS. "" ) $ THEN INQ FILE "Please enter file [e.g. DATA.DAT to exit]" $ ELSE FILE = P1 $ ENDIF $ IF "''FILE'" .EQS. "" THEN EXIT $ IF F$SEARCH("''FILE'") .EQS. "" THEN GOTO ERR1 $ HIGH = F$PARSE(F$SEARCH("''FILE'"+";0"),,,"VERSION")-";" $ LOW = F$PARSE(F$SEARCH("''FILE'"+";-0"),,,"VERSION")-";" $ SUBJ = "''FILE'"+";"+"''LOW'" $SEQ: RENAME/NOLOG 'SUBJ' ;'KOUNT' $ KOUNT = KOUNT+1 $ GOSUB CHECK $ GOTO SEQ $DONE: P1 = "" $ KOUNT = 1 $ INQ MORE "Do you wish resequence more version numbers [Y/N]" $ IF ("''MORE'" .EQS. "YES") .OR. ("''MORE'" .EQS. "Y") THEN GOTO ASK $CLEAR: EXIT $!----------------------------------------------------------------------- $ERR1: SAY "" $ SAY " *** File doesn't exist ( in this directory ) ! ***" $ SAY "" $ P1 = "" $ GOTO ASK $!----------------------------------------------------------------------- $CHECK: LOW = LOW+1 $ IF ("''LOW'" .GT. "''HIGH'") THEN GOTO DONE $ SUBJ = "''FILE'"+";"+"''LOW'" $ IF F$SEARCH("''SUBJ'") .EQS. "" THEN GOTO CHECK $ RETURN $!----------------------------------------------------------------------- ---------------------------------------------------------------------- * Csaba I. Harangozo | 'To err is human', said the hedgehog * csabah@zipworld.com.au | as he dismounted a wirebrush. ---------------------------------------------------------------------- EARTH::AUSTRALIA:[SYDNEY]HARANGOZO.CSABA;1, delete? [N]: