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

COM submission at top of hour

 
SOLVED
Go to solution

COM submission at top of hour

Greetings.. I'm trying to submit a VMS/Alpha COM file at the top of the next hour. I'm getting close to the correct syntax, but I just need a bit more help. Can someone help me with the syntax of finding the top of the next hour? I'm not worried about midnight (right now) - I'll work on that after I get what I'm after currently.

I'm trying to get "new_string" to be "TODAY+9:00" (given the times below). I've spaced out the single/double quotes for readability.

$ time=f$cvtime("","absolute","time")
$ write sys$output "time = ", time
$ cur_hour = f$integer(f$cvtime(f$time(),,"hour"))
$ write sys$output "cur_hour = ", cur_hour
$ nxt_hour = cur_hour + 1
$ write sys$output "nxt_hour = ", nxt_hour
$ new_string = "TODAY+ ' ' nxt_hour ' ' + ' ' :00 ' ' "
$ write sys$output "new_string = ", new_string


time = 08:43:43.87
cur_hour = 8
nxt_hour = 9
new_string = TODAY+9'+:00

Thanks,
- Martin
7 REPLIES 7
Duncan Morris
Honored Contributor
Solution

Re: COM submission at top of hour

Martin, as a quick fix to your DCL without going into the best way to obtain these times, use this syntax:

$ new_string = "TODAY+''nxt_hour':00"

Volker Halle
Honored Contributor

Re: COM submission at top of hour

Martin,

how about this (also takes care of midnight):

$ tim=F$CVTIME(,"ABSOLUTE")
$ sho sym tim
$ nxt_tim=F$CVTIME("''tim'+0-1","ABSOLUTE","DATE")+":"+-
F$CVTIME("''tim'+0-1","ABSOLUTE","HOUR")
$ SHO SYMB nxt_tim

Volker.
Duncan Morris
Honored Contributor

Re: COM submission at top of hour

Doesn't look so nice in HTML

so

$ new_string = "TODAY+ ' ' nxt_hour ':00"

Whole string in double quotes. Items which need to be replaced in 2 single quotes at the front and one single quote to terminate

Re: COM submission at top of hour

Thanks - that was exactly what I needed!

~ Martin
Ken Robinson
Valued Contributor

Re: COM submission at top of hour

Try this code. I haven't checked it for all possibilities yet...

$ set noon
$ set nover
$ nxt = f$cvt("+1","absolute","datetime")
$ nh = f$cvt(nxt,,"hour")
$ nd = f$cvt(nxt,,"date")
$ today = f$cvt(,,"date")
$ if nd .eqs. today
$ then
$ after = "/after=''nh':00"
$ else
$ after = "/tomorrow"
$ endif
$ write sys$output "''after
$ exit
Phillip Thayer
Esteemed Contributor

Re: COM submission at top of hour

How about a one liner:

nxt_hr = f$element(0,":",f$element(1," ",f$cvtime("+1:00:00")))+":00"

write sys$output nxt_hr

NXT_HR = "13:00"

Phil
Once it's in production it's all bugs after that.
Robert_Boyd
Respected Contributor

Re: COM submission at top of hour

$ this_minute = F$CVTIME("",,"MINUTE")
$ rest_of_hour = 60-'this_minute'
$ submit 'COM'/after="+0-0:'rest_of_hour'"

Robert
Master you were right about 1 thing -- the negotiations were SHORT!