HP OpenVMS Systemsask the wizard |
The Question is: I know that file version numbers range from 1 to 32767. What I would like to be able to do, is take a filename that has many version, remove those not required (either by purge or delete) and then re number the remaining files from version 1 upwards. Preferably in a DCL command procedure. If you have heard of such a procedure please either email it to me or tell me where it could be obtianed from. Thanks in advance. Donald The Answer is :
Using a temporary directory or a temporary name, you can accomplish
what you desire through the use of a wildcard RENAME to a specific
-- yet wild-carded -- target specification. (In the following example
commands, the use of the ";" delimiter is critical!)
$ RENAME shuffle.dat;* [.TMP]; ! From high to low, into 1 to oldest
$ RENAME [.TMP]shuffle.dat;* []; ! From 1 to old, into 1 to latest
Alternatively, if you can use PURGE/KEEP=n, you can use a command sequence
similar to the following:
$ PURGE/KEEP=3 *.*
$ RENAME *.*;-2 *.*;1
$ RENAME *.*;-1 *.*;2
$ RENAME *.*;0 *.*;3
Note that the RENAME command can fail if there are less than the required
number of versions, thus the use of SET NOON or similar is recommended
or (better) the use of a conditional using f$search() to select when the
RENAME should be performed:
$ IF F$SEARCH("*.*;-2",1) .NES. "" then RENAME *.*;-2 *.*;1
|