openvmsdcl

OpenVMS - batch to check if running latest version of script


Is it possible to code a batch script to check that there has been no versions added since this one was queued up and if so run the updated script instead.

I could do this by sub-scripting it but that would mean 2 scripts for each script i have in place.

Thanks for any help.


Solution

  • f$environment and f$search are the lexical functions you may want to use. My example strips off the version with f$extract, but you may want to use f$parse.

    $ this = f$environment("PROCEDURE") 
    $ write sys$output "This is ", this
    $ noversion = f$extract (0,f$locate(";",this),this)
    $ write sys$output "without version it is ", noversion
    $ latest = f$search (noversion)
    $ write sys$output "latest version is ", latest
    $ if this .nes. latest -
            then $ write sys$output "There is a new version!"