Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

File Version limit Reset

6 views
Skip to first unread message

rexr...@gmail.com

unread,
Aug 6, 2007, 9:39:11 PM8/6/07
to
Hi,

I was hoping someone may have already written a DCL procedure for this
problem. I have searched but could not find anything.

I would like to reset the version number on a file once it reaches or
approaches 32767.

e.g.

If I had 3 files

file.dat;32767
file.dat;32766
file.dat;32765

I would like to run the procedure and set the version number on the
files as follows :

file.dat;3
file.dat;2
file.dat;1

Hoping someone may be able to help

Thanks,

Steven M. Schweda

unread,
Aug 6, 2007, 9:51:31 PM8/6/07
to
From: rexr...@gmail.com

> I was hoping someone may have already written a DCL procedure for this
> problem. I have searched but could not find anything.
>
> I would like to reset the version number on a file once it reaches or
> approaches 32767.

> [...]

I have some (probably rough) code in my TCPIP$SMTP_RECV_RUN.COM to
deal with the TCPIP$SMTP_RECV_RUN.LOG files. I've been meaning to
extract and generalize it a bit, especially since I discovered that
SYS$SYSDEVICE:[TCPIP$SSH]TCPIP$SSH_RUN.LOG is also climbing out of
sight. I use a lock file near the file to be purged/reversioned (and
another trick or two) to avoid having two jobs collide. If you don't
get any better offers, let me know, and I can probably get to work and
beat it into better (less embarassing) shape. (It may be flawed, but it
has been working acceptably for some months now on the SMTP logs. At
the rate I get junk e-mail connections, it probably resets the versions
every few days. Of course, its proper operation could be more by luck
than design.)

It would be nice, if HP plans to continue to cause this problem, if
they also supplied a good solution for it.

------------------------------------------------------------------------

Steven M. Schweda sms@antinode-org
382 South Warwick Street (+1) 651-699-9818
Saint Paul MN 55105-2547

Richard B. Gilbert

unread,
Aug 6, 2007, 10:40:37 PM8/6/07
to

$ RENAME FILE>DAT;32765 ;1
$ RENAME FILE.DAT;32766 ;2
$ REMA<E FILE.DAT;32767 ;3

Ruger

unread,
Aug 6, 2007, 11:20:03 PM8/6/07
to
On Aug 7, 11:51 am, s...@antinode.org (Steven M. Schweda) wrote:
> From: rexru...@gmail.com

Thanks Steven,

If you would be able to post your procedure it would be much
appreciated.

Thanks Russell,

I know about the rename, I gave an example of 3 files but I am talking
more about 100's which I would like to rename and keep in version
order through a daily/weekly submitted procedure.

Joseph Huber

unread,
Aug 7, 2007, 4:02:22 AM8/7/07
to
Richard B. Gilbert wrote:

> rexr...@gmail.com wrote:
>>
>> I would like to reset the version number on a file once it reaches or
>> approaches 32767.
>>
>
> $ RENAME FILE>DAT;32765 ;1
> $ RENAME FILE.DAT;32766 ;2
> $ REMA<E FILE.DAT;32767 ;3
>

Although it does not care for locked files, I'm using a procedure posted
(here ?) 10 years ago:

http://wwwvms.mppmu.mpg.de/vms$common/sysmgr/FIND_HIGH_VERSIONS.COM

--

Joseph Huber - http://www.huber-joseph.de

Jim Duff

unread,
Aug 7, 2007, 7:06:25 AM8/7/07
to

This procedure requires that you specify the number of versions to save,
but it will give you a start on saving all versions...


$! See bottom of file for comments
$ if f$edit (p1,"collapse,uncomment") .eqs. ""
$ then
$ write sys$output "P1 must specify a filename"
$ exit 44
$ endif
$ if f$edit (p2,"collapse,uncomment") .eqs. ""
$ then
$ p2 = 1
$ endif
$ log_file = f$search (p1)
$ if log_file .nes. ""
$ then
$ version = f$parse (log_file,,,"version") - ";"
$ log_file = f$element (0, ";", log_file)
$ keep = f$integer (p2)
$ if f$integer (version) .gt. 32000
$ then
$ purgex 'log_file'/keep='keep'
$ search = log_file + ";-"
$ v = 1
$vloop:
$ file = f$search ("''search'''keep'")
$ if file .eqs. ""
$ then
$ goto next_v
$ endif
$ renamex 'file' *.*;'v'
$ v = v + 1
$next_v:
$ keep = keep - 1
$ if keep .ge. 0
$ then
$ if keep .eq. 0
$ then
$ search = search - "-"
$ endif
$ goto vloop
$ endif
$end_vloop:
$ endif
$ endif
$ exit
$!++
$! Description:
$!
$! Given a file, purge it to the requested number of versions.
$!
$! If the top level version of the file is over 32000, then the
$! remaining files after the purge will be renamed so the lowest
$! version number is 1.
$!
$! P1 = File to purge (required)
$! P2 = versions to keep (optional, defaults to 1)
$!
$!
$! Author: James F. Duff
$!
$! Date: 24-Mar-2004
$!
$! Modifications:
$!
$! Who Date Version What
$!
------------------------------------------------------------------------
$! JFD 24-Mar-2004 X01-00 Original version of module
$!
$!--

Cheers,
Jim.
--
www.eight-cubed.com

Brad Hamilton

unread,
Aug 7, 2007, 8:37:45 AM8/7/07
to
In article <1186456803.3...@i38g2000prf.googlegroups.com>, Ruger wrote:
[...]

>Thanks Steven,
>
>If you would be able to post your procedure it would be much
>appreciated.
>
>Thanks Russell,
>
>I know about the rename, I gave an example of 3 files but I am talking
>more about 100's which I would like to rename and keep in version
>order through a daily/weekly submitted procedure.
>

In addition to all the nice suggestions here, dcl.openvms.org contains a fairly
large repository of DCL code to perform all sorts of tricks, including at least
one more version of the RENAME problem :-). Although there is no "search"
feature within the site, (that I can see) it would be well worth an evening's
effort to peruse the site, to see what additional treasure may be buried there.

IanMiller

unread,
Aug 7, 2007, 8:52:48 AM8/7/07
to
dcl.openvms.org does have a search facility - the 'search' link on the
top bar leads to

http://dcl.openvms.org/search.php

cycl...@excite.com

unread,
Aug 7, 2007, 10:12:43 AM8/7/07
to
Been using this rename procedure for a long time.

$!
$ verify = F$VERIFY(0)
$ say == "WRITE SYS$OUTPUT"
$ say ""
$ say ""
$ IF p1 .eqs. "" THEN GOTO HELP
$ filename = p1
$ filename = F$PARSE( filename,,, "DEVICE" ) + -
F$PARSE( filename,,, "DIRECTORY" ) + -
F$PARSE( filename,,, "NAME" ) + -
F$PARSE( filename,,, "TYPE" )
$!
$ say ""
$ say "Operating on ''filename'"
$ on control_y then GOTO EXIT_PROC
$ on error then GOTO EXIT_PROC
$ low_version = F$SEARCH( filename+";-0" ) !Find the
lowest vers
$ IF low_version .EQS. "" THEN GOTO EXIT_PROC !File not
found
$
$ old_version = f$PARSE( low_version,,, "VERSION" ) !Get the
version
$ old_version = f$EXTRACT( 1, 5, old_version ) !Trim leading
";"
$ new_version = 1 !Start with 1
$ LOOP:
$ low_version = F$SEARCH( "''filename';''old_version'" )
$ IF low_version .NES. ""
$ THEN RENAME/LOG 'filename';'old_version'
'filename';'new_version'
$ new_version = new_version + 1
$ ENDIF
$ hi_version = - !Establish hi
version
F$extract( 1, 5, f$PARSE( f$SEARCH( "''filename';0" ),,,
"VERSION" ))
$ IF old_version .GE. hi_version THEN GOTO EXIT_PROC
$ old_version = old_version + 1
$ goto loop
$ EXIT_PROC:
$ say "End Date/Time : ''F$TIME()'"
$ verify = F$VERIFY( verify )
$ EXIT
$ HELP:
$ say ""
$ say "This procedure renames a series of version(s) of a file."
$ say "It renames the lowest version to ;1, next to ;2, etc."
$ say ""
$ say "p1 = disk:[directory]filename (version number not
necessary)"
$ verify = F$VERIFY( verify )
$ EXIT

Dave Gullen

unread,
Aug 7, 2007, 10:38:05 AM8/7/07
to
It helps to make sure you've got enough spare slots underneath the
lowest version. Then you can automate, by having a job that scans for
all files abouve a particular version, say 25000, and automatically
lower versions or warn if there's no room.


Carl Friedberg

unread,
Aug 7, 2007, 11:29:46 AM8/7/07
to
If anyone is interested, I have a short perl script which handles the
rename (after the purge has been done). This script always ends
up with the lowest version at ;1, and will correctly order them
upwards. Skipped versions (such as you get when purging log
files, where some are kept open) are handled so the end result
is strictly monotonically increasing version numbers, for arbitrary
wildcards. Ask for purged_rename.pl carl () comets [] com

AEF

unread,
Aug 7, 2007, 11:53:14 AM8/7/07
to
On Aug 7, 11:29 am, "Carl Friedberg" <frida.fr...@gmail.com> wrote:
> If anyone is interested, I have a short perl script which handles the
> rename (after the purge has been done). This script always ends
> up with the lowest version at ;1, and will correctly order them
> upwards. Skipped versions (such as you get when purging log
> files, where some are kept open) are handled so the end result
> is strictly monotonically increasing version numbers, for arbitrary
> wildcards. Ask for purged_rename.pl carl () comets [] com

I assume by "strictly monotonically increasing" you instead mean no
gaps in the version numbers. So that you would have, e.g., ;1, ;2, ;
3, ... instead of ;1, ;4, ;9, ....

Hein RMS van den Heuvel

unread,
Aug 7, 2007, 12:43:14 PM8/7/07
to
On Aug 7, 11:29 am, "Carl Friedberg" <frida.fr...@gmail.com> wrote:
> If anyone is interested, I have a short perl script which handles the
> rename (after the purge has been done).

Here is on other quick perl 'one liner':

$ perl -e "$f=shift; foreach (reverse glob qq($f;*)){ $i++; ($n,
$v)=split /;/; last if $n ne $f; rename $_, qq($f;$i)}" file.ext

With a hardcoded file name it simplyfies to:

$ perl -e "foreach (reverse glob q(file.ext;*)){ $i++; ($n,
$v)=split /;/; rename $_, qq($n;$i)}"

The part "last if $n ne $f" makes sure a single simple file spec was
passed in such that the script does not go wild.

Note... perl would process a file.ext;* as argument into many
arguments matching all the wildcarded specs unless triple quoted, so
it seemed easier and safer to hard code adding ;8 for this specific
usage.

Cheers,
Hein.

Michael Moroney

unread,
Aug 7, 2007, 12:50:10 PM8/7/07
to

I no longer have the source, but long ago I had a .COM that did this:

V1 = version # of "foo.bar;" (highest version)
V2 = version # of "foo.bar;-0" (lowest version)
total = V1-V2+1 (# of versions if no gaps)

Repeat "total" times with I going from 1 to total, and J from V2 to V1:
Rename ";J" to ";I"

There was logic to deal with gaps (if something in the middle was
deleted).

Feel free to reinvent it from this.

Ruger

unread,
Aug 7, 2007, 7:45:09 PM8/7/07
to
Thanks very much to everyone who has responded and also those who
posted procedures - you have all been very helpful !!

David J Dachtera

unread,
Aug 7, 2007, 10:24:05 PM8/7/07
to

Well, the easiest would be two steps:

$ rename file.dat;* *.tad
$ rename file.tad;* *.dat

Obviously, that makes many brash assumptions.

--
David J Dachtera
dba DJE Systems
http://www.djesys.com/

Unofficial OpenVMS Marketing Home Page
http://www.djesys.com/vms/market/

Unofficial Affordable OpenVMS Home Page:
http://www.djesys.com/vms/soho/

Unofficial OpenVMS-IA32 Home Page:
http://www.djesys.com/vms/ia32/

Unofficial OpenVMS Hobbyist Support Page:
http://www.djesys.com/vms/support/

Brian Tillman

unread,
Aug 9, 2007, 2:38:32 PM8/9/07
to

"Dave Gullen" <dave....@gap.co.uk> wrote in message
news:1186497485.2...@k79g2000hse.googlegroups.com...

By definition, wouldn't the only requirement be one open slot, since the
procedure RENAMEs the lowest to ;1 (freeing up the prior lowest slot)?
--
Brian Tillman

Peter 'EPLAN' LANGSTOeGER

unread,
Aug 20, 2007, 3:42:39 AM8/20/07
to
In article <1186456803.3...@i38g2000prf.googlegroups.com>, Ruger <rexr...@gmail.com> writes:
>I know about the rename, I gave an example of 3 files but I am talking
>more about 100's which I would like to rename and keep in version
>order through a daily/weekly submitted procedure.

Change the directory (logical) daily/weekly instead...

--
Peter "EPLAN" LANGSTOEGER
Network and OpenVMS system specialist
E-mail pe...@langstoeger.at
A-1030 VIENNA AUSTRIA I'm not a pessimist, I'm a realist

0 new messages