Rename Script VMS

February 6, 2012 at 12:27:52
Specs: OpenVMS
Very new to VMS trying to figure this out and in my head it looks pretty easy, however I cannot get it to work.

I need a script that: If File named report1 in DISK$LOG:[USER1], rename to DISK$LOG:[USER1]report1_+todays date, and to have it run everyday at 7am.


See More: Rename Script VMS

Report •

#1
February 6, 2012 at 23:32:55
Parse the file specification into it's constituents:

$ file=f$search("DISK$LOG:[USER1]report1")
$ devdir = f$parse(file,,,"DEVICE")+f$parse(file,,,"DIRECTORY")
$ fn = f$parse(file,,,"NAME")
$ ft =f$parse(file,,,"TYPE")
$ fv = f$parse(file,,,"VERSION")

Get todays date:
$ date=f$cvtim("","comparison","date")

new file name:
$ fn=fn+"_"+date

complete new filespecification:
$ filen=devdir+fn+ft+fv
$! show symbol filen
$ rename/log 'file' 'filen'

For details on the functions used see HELP LEXICAL .

For scheduling to run a job once a day, do a little search here in this forum,
there are several entries, for example this one:
http://www.computing.net/answers/op...

To get the name of the executing procedure for resubmit:
$ thisproc = f$environment("PROCEDURE")
If You want to be able to edit the procedure and resubmit the newest version, use the parsing technique above, and remove the version (+fv) from the filename to submit.


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


Report •

#2
February 7, 2012 at 08:14:05
Thank you Joseph that was very helpful!

Report •
Related Solutions


Ask Question