Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Gather the top file version limit# and the name of the files

 
SOLVED
Go to solution
Navipa
Frequent Advisor

Gather the top file version limit# and the name of the files

Hi All,

I would like to browse through the entire system disk and find the file name which has the toppest file version and reset it version to 1, 2, 3, etc.

 

I see there are one or two DCL samples which will reset the file version to 1, 2, etc. But for that we need to provide the filename as the argument. Instead I would like to pass the version# as a paramater. As I don't know which file's version keep growing, I would like to reset the file version only to the files which has its file version is greater than the given version#. I know there should be a way to do this, but I would like to use the script if any of you use or suggest.

 

I use VAX/OpenVMS 6.1 and the emulated version.

 

Thanks

Naivipa

 

4 REPLIES 4
abrsvc
Respected Contributor

Re: Gather the top file version limit# and the name of the files

Experiment a little and you can learn much.

 

If you use the DIRECTORY command using "*.*;" as the filename, you will see only the highest version of a particular file.

Use that command within a procedure to generate a list of the highest versions and go from there.  A simple loop to compare each file version number with the passed parameter value and away you go.

 

Please note that altering the highest version number to a specific version will not "erase" any that have lower version numbers. 

 

It sounds like you really only want 1 version to exist at a time with a low version number.  If this is true, then you must also include a PURGE operation to a single version followed by a RENAME to the version number you select.

 

Hope this helps,

Dan

H.Becker
Honored Contributor
Solution

Re: Gather the top file version limit# and the name of the files

>>> I would like to browse through the entire system disk and find the file name which has the toppest file version and reset it version to 1, 2, 3, etc.

 

I'm not sure I fully understand what you want to do.

 

The toppest file version can be specified with ";0". To rename all files with the toppest file version to version 1 a command like

$ rename [...]*.*;0 ;1

 should do.

 

If you have a version limit of 3 and you want to rename all files  - no matter how many versions there are - to version ;3, ;2, and ;1 you can do this with three rename commands, like:

 

$ cre/dir [.zzz]
$ copy nla0: [.zzz]a.b;17
$ copy nla0: [.zzz]a.b;18
$ copy nla0: [.zzz]a.b;21
$ copy nla0: [.zzz]x.y;3 
$ copy nla0: [.zzz]c.z;12
$ copy nla0: [.zzz]c.z;23
$ dir [.zzz]/date

Directory EISNER$DRA3:[DECUSERVE_USER.BECKER_H.ZZZ]

A.B;21               29-JAN-2015 06:54:33.98
A.B;18               29-JAN-2015 06:54:33.97
A.B;17               29-JAN-2015 06:54:33.96
C.Z;23               29-JAN-2015 06:54:43.48
C.Z;12               29-JAN-2015 06:54:43.46
X.Y;3                29-JAN-2015 06:54:33.99

Total of 6 files.
$ rename [.zzz]*.*;-2 ;1
$ rename [.zzz]*.*;-1 ;2
$ rename [.zzz]*.*;0 ;3
$ dir [.zzz]/date

Directory EISNER$DRA3:[DECUSERVE_USER.BECKER_H.ZZZ]

A.B;3                29-JAN-2015 06:54:33.98
A.B;2                29-JAN-2015 06:54:33.97
A.B;1                29-JAN-2015 06:54:33.96
C.Z;3                29-JAN-2015 06:54:43.48
C.Z;2                29-JAN-2015 06:54:43.46
X.Y;3                29-JAN-2015 06:54:33.99

Total of 6 files.
$ 

 

However, you may want to have a look at the documentation to understand how defaulting of filen ame, type etc. works.

Hein van den Heuvel
Honored Contributor

Re: Gather the top file version limit# and the name of the files

6.1 huh? That sucks.

I don't think there is a DFU for that.

With DFU it is ease to find files which may need attention:

 

$ DFU search /version=min=30000 dka0:
%DFU-I-SEARCH, Start search on DKA0: (EISNER$DKA0:)

[]MESSAGE.TXT;32767 1/10
[]LOGIN.COM;32767 2/10
[]FTP_SERVER.LOG;30000 9/10
[]FTP_SERVER.LOG;30001 9/10

:

 

 

I use a helper directory for no-brainer rename.

Watch this:

 

$ del a.txt;*
$ creat a.txt;10
one
$ creat a.txt;11
two
$ creat a.txt;12
three
$ cre /dir [.helper]
$ rename /log a.txt;* [.helper];
%RENAME-I-RENAMED, [TMP]A.TXT;12 renamed to [TMP.HELPER]A.TXT;1
%RENAME-I-RENAMED, [TMP]A.TXT;11 renamed to [TMP.HELPER]A.TXT;2
%RENAME-I-RENAMED, [TMP]A.TXT;10 renamed to [TMP.HELPER]A.TXT;3
$ typ [.helper]a.txt;1  !  <--- !! bad
three
$ rename /log [.helper]a.txt;* [];
%RENAME-I-RENAMED, [TMP.HELPER]A.TXT;3 renamed to [TMP]A.TXT;1
%RENAME-I-RENAMED, [TMP.HELPER]A.TXT;2 renamed to [TMP]A.TXT;2
%RENAME-I-RENAMED, [TMP.HELPER]A.TXT;1 renamed to [TMP]A.TXT;3
$ type a.txt;1  !  <--- !! good again. :-)
one

 

Hein.

Navipa
Frequent Advisor

Re: Gather the top file version limit# and the name of the files

Thanks H.Becker, it helped me and I followed similar style of coding and it worked.