Reputation: 295
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.
Upvotes: 3
Views: 605
Reputation: 193
You could submit a "jacket" procedure that does nothing else but run the actual procedure.
Jacket Procedure JACKET.COM
$ SUBMIT/AFTER= [...] JACKET.COM
$ @REAL_PROCEDURE "''P1'" "''P2'" "''P3'" [...]
JACKET.COM is never updated. The current version of REAL_PROCEDURE.COM will be run when the batch job executes.
Upvotes: 0
Reputation: 1463
For your typical self-submitting batch job the big thing is to at least strip of the version before the resubmit to pick up the then-current version. Here an example using F$ELEMENT (sooo much easier than F$PARSE :-).
$ redo = "submit/log/noprint/noti/queue=" + -
f$getqui("DISPLAY_QUEUE","QUEUE_NAME","*","THIS_JOB")
$ restart = "tomorrow + 07:00:00" ! First daily run, Alter as needed.
$ if time.lts."12:00" then restart = "17:00:00" ! Second daily run, Alter as needed.
$ redo /after="''restart'"/para=("''p1'","''p2'","''p3'") 'f$elem(0,";",f$environment("procedure"))
Next, as submitter/changer of the command file you decide whether the already scheduled next run is to use the new version or the then current version WHICH IS REMEMBERED THROUGH THE FILE-ID, not its name. If you want to start using the new version immediately, just use
$ COPY /OVER my-script.com ;-1 /LOG
%COPY-I-OVERLAY, MY-SCRIPT.COM;35 being overwritten
%COPY-S-COPIED, MY-SCRIPT.COM;36 copied to MY-SCRIPT.COM;35 (5 blocks)
Cheers, Hein
Upvotes: 1
Reputation: 1072
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!"
Upvotes: 3