Hi:
Iīm looking for a command procedure to send a operatorīs message
if the day is the third sunday in the month.
Can you help me ?
Thank you.
Printable View
Hi:
Iīm looking for a command procedure to send a operatorīs message
if the day is the third sunday in the month.
Can you help me ?
Thank you.
On 08/29/07 14:57, [email]apogeusistemas@gmail.com[/email] wrote:[color=blue]
> Hi:
> Iīm looking for a command procedure to send a operatorīs message
> if the day is the third sunday in the month.
> Can you help me ?[/color]
I think I'd create an indexed (or flat, if that's easier for you)
file with columns like
DATE
WEEK-OF-YEAR
WEEK-OF-MONTH
Once per Sunday, search the file for the current date, and if that
record's WEEK-OF-MONTH .EQ. 3 then Boob's Your Uncle.
--
Ron Johnson, Jr.
Jefferson LA USA
Give a man a fish, and he eats for a day.
Hit him with a fish, and he goes away for good!
On Aug 29, 12:57 pm, apogeusiste...@gmail.com wrote:[color=blue]
> Iīm looking for a command procedure to send a operatorīs message
> if the day is the third sunday in the month.[/color]
Basic idea (use account with OPER priv):
$ if F$CVTIME(,,"weekday") .eqs. "Sunday"
$ then
$ day = F$CVTIME(,,"day")
$ if day .gt. 14 .and. day .lt. 22 then reply/username=system "3rd
sunday"
$ endif
$ submit /after=tomorrow 'F$ENVIRONMENT("procedure")
James
On 08/29/07 16:26, [email]nitromh@gmail.com[/email] wrote:[color=blue]
> On Aug 29, 12:57 pm, apogeusiste...@gmail.com wrote:[color=green]
>> Iīm looking for a command procedure to send a operatorīs message
>> if the day is the third sunday in the month.[/color]
>
> Basic idea (use account with OPER priv):
>
> $ if F$CVTIME(,,"weekday") .eqs. "Sunday"
> $ then
> $ day = F$CVTIME(,,"day")
> $ if day .gt. 14 .and. day .lt. 22 then reply/username=system "3rd
> sunday"
> $ endif
> $ submit /after=tomorrow 'F$ENVIRONMENT("procedure")[/color]
Does "week" start on the first day of the month, or ...
Never mind.
--
Ron Johnson, Jr.
Jefferson LA USA
Give a man a fish, and he eats for a day.
Hit him with a fish, and he goes away for good!
On 29 ago, 19:37, Ron Johnson <ron.l.john...@cox.net> wrote:[color=blue]
> On 08/29/07 16:26, nitr...@gmail.com wrote:
>[color=green]
> > On Aug 29, 12:57 pm, apogeusiste...@gmail.com wrote:[color=darkred]
> >> Iīm looking for a command procedure to send a operatorīs message
> >> if the day is the third sunday in the month.[/color][/color]
>[color=green]
> > Basic idea (use account with OPER priv):[/color]
>[color=green]
> > $ if F$CVTIME(,,"weekday") .eqs. "Sunday"
> > $ then
> > $ day = F$CVTIME(,,"day")
> > $ if day .gt. 14 .and. day .lt. 22 then reply/username=system "3rd
> > sunday"
> > $ endif
> > $ submit /after=tomorrow 'F$ENVIRONMENT("procedure")[/color]
>
> Does "week" start on the first day of the month, or ...
>
> Never mind.
>
> --
> Ron Johnson, Jr.
> Jefferson LA USA
>
> Give a man a fish, and he eats for a day.
> Hit him with a fish, and he goes away for good![/color]
Maybe I need change the day from 22 to 23...
$ set nover
$ hour="''F$EXTRACT(12,2, F$TIME())'"
$ day=F$CVTIME(,,"day")
$ week=F$CVTIME(,,"weekday")
$ if ((week .eqs. "Sunday") .and. (day .gt. "14") .and. (day .lt.
"23") .and. (hour .eq. "12")) then goto dispara
$exit
$dispara:
$ mail/subj=" >>> Restarte o Server <<< " sys
$login:restart_server.txt "smtp%""schwarzt@aaaaaaa.com.br"""
$exit
Thanks a lot for your examples !
On Aug 29, 5:47 pm, apogeusiste...@gmail.com wrote:[color=blue][color=green]
> > On 08/29/07 16:26, nitr...@gmail.com wrote:[/color]
>[color=green][color=darkred]
> > > On Aug 29, 12:57 pm, apogeusiste...@gmail.com wrote:
> > >> Iīm looking for a command procedure to send a operatorīs message
> > >> if the day is the third sunday in the month.[/color][/color]
>[color=green][color=darkred]
> > > Basic idea (use account with OPER priv):[/color][/color]
>[color=green][color=darkred]
> > > $ if F$CVTIME(,,"weekday") .eqs. "Sunday"
> > > $ then
> > > $ day = F$CVTIME(,,"day")
> > > $ if day .gt. 14 .and. day .lt. 22 then reply/username=system "3rd
> > > sunday"
> > > $ endif
> > > $ submit /after=tomorrow 'F$ENVIRONMENT("procedure")[/color][/color]
>
> Maybe I need change the day from 22 to 23...[/color]
If the 1st is a Monday, the 3rd Sunday will be the 21st. If the 1st is
Sunday, the 3rd Sunday will be the 15th and 4th Sunday will be the
22nd so if you use .lt.23, you'll include the 4th Sunday in those
months.
[color=blue]
>
> $ set nover
> $ hour="''F$EXTRACT(12,2, F$TIME())'"
> $ day=F$CVTIME(,,"day")
> $ week=F$CVTIME(,,"weekday")
> $ if ((week .eqs. "Sunday") .and. (day .gt. "14") .and. (day .lt.
> "23") .and. (hour .eq. "12")) then goto dispara[/color]
You don't want " " around numbers unless you first convert them to a
string, and then you need to use .gts. and .lts. if you're comparing
strings.
[color=blue]
> $exit
> $dispara:
> $ mail/subj=" >>> Restarte o Server <<< " sys
> $login:restart_server.txt "smtp%""schwa...@aaaaaaa.com.br"""
> $exit
>
> Thanks a lot for your examples ![/color]
On Aug 29, 3:57 pm, apogeusiste...@gmail.com wrote:[color=blue]
> Hi:
> Iīm looking for a command procedure to send a operatorīs message
> if the day is the third sunday in the month.
> Can you help me ?
> Thank you.[/color]
I would identify the day of week associated with the 1st of the month;
adjust for the day of the week, and then add 14 to get the third
Sunday.
You want to look at the various options for the F$CVTIME lexical
function (see the HELP text)
- Bob Gezelter, [url]http://www.rlgsc.com[/url]
On Aug 29, 6:47 pm, apogeusiste...@gmail.com wrote:[color=blue]
> On 29 ago, 19:37, Ron Johnson <ron.l.john...@cox.net> wrote:
>
>
>
>
>[color=green]
> > On 08/29/07 16:26, nitr...@gmail.com wrote:[/color]
>[color=green][color=darkred]
> > > On Aug 29, 12:57 pm, apogeusiste...@gmail.com wrote:
> > >> Iīm looking for a command procedure to send a operatorīs message
> > >> if the day is the third sunday in the month.[/color][/color]
>[color=green][color=darkred]
> > > Basic idea (use account with OPER priv):[/color][/color]
>[color=green][color=darkred]
> > > $ if F$CVTIME(,,"weekday") .eqs. "Sunday"
> > > $ then
> > > $ day = F$CVTIME(,,"day")
> > > $ if day .gt. 14 .and. day .lt. 22 then reply/username=system "3rd
> > > sunday"
> > > $ endif
> > > $ submit /after=tomorrow 'F$ENVIRONMENT("procedure")[/color][/color]
>[color=green]
> > Does "week" start on the first day of the month, or ...[/color]
>[color=green]
> > Never mind.[/color]
>[color=green]
> > --
> > Ron Johnson, Jr.
> > Jefferson LA USA[/color]
>[color=green]
> > Give a man a fish, and he eats for a day.
> > Hit him with a fish, and he goes away for good![/color]
>
> Maybe I need change the day from 22 to 23...
>
> $ set nover
> $ hour="''F$EXTRACT(12,2, F$TIME())'"
> $ day=F$CVTIME(,,"day")
> $ week=F$CVTIME(,,"weekday")
> $ if ((week .eqs. "Sunday") .and. (day .gt. "14") .and. (day .lt.
> "23") .and. (hour .eq. "12")) then goto dispara
> $exit
> $dispara:
> $ mail/subj=" >>> Restarte o Server <<< " sys
> $login:restart_server.txt "smtp%""schwa...@aaaaaaa.com.br"""
> $exit
>
> Thanks a lot for your examples !- Hide quoted text -
>
> - Show quoted text -[/color]
As was pointed out, you must use .GT. 14 and .LT. 22
Why are you including (HOUR .EQ. 12) ???
If you schedule the batch job to submit itself every morning then it
will send the message each morning. If you need this to happen only
during the noon hour then submit the job to run at noon.
I would be concerned that by including (HOUR .EQ. 12) you might end up
off schedule and not get the message being sent even though the day is
the third Sunday.
On 29 ago, 21:37, FrankS <sapie...@noesys.com> wrote:[color=blue]
> On Aug 29, 6:47 pm, apogeusiste...@gmail.com wrote:
>
>
>
>
>[color=green]
> > On 29 ago, 19:37, Ron Johnson <ron.l.john...@cox.net> wrote:[/color]
>[color=green][color=darkred]
> > > On 08/29/07 16:26, nitr...@gmail.com wrote:[/color][/color]
>[color=green][color=darkred]
> > > > On Aug 29, 12:57 pm, apogeusiste...@gmail.com wrote:
> > > >> Iīm looking for a command procedure to send a operatorīs message
> > > >> if the day is the third sunday in the month.[/color][/color]
>[color=green][color=darkred]
> > > > Basic idea (use account with OPER priv):[/color][/color]
>[color=green][color=darkred]
> > > > $ if F$CVTIME(,,"weekday") .eqs. "Sunday"
> > > > $ then
> > > > $ day = F$CVTIME(,,"day")
> > > > $ if day .gt. 14 .and. day .lt. 22 then reply/username=system "3rd
> > > > sunday"
> > > > $ endif
> > > > $ submit /after=tomorrow 'F$ENVIRONMENT("procedure")[/color][/color]
>[color=green][color=darkred]
> > > Does "week" start on the first day of the month, or ...[/color][/color]
>[color=green][color=darkred]
> > > Never mind.[/color][/color]
>[color=green][color=darkred]
> > > --
> > > Ron Johnson, Jr.
> > > Jefferson LA USA[/color][/color]
>[color=green][color=darkred]
> > > Give a man a fish, and he eats for a day.
> > > Hit him with a fish, and he goes away for good![/color][/color]
>[color=green]
> > Maybe I need change the day from 22 to 23...[/color]
>[color=green]
> > $ set nover
> > $ hour="''F$EXTRACT(12,2, F$TIME())'"
> > $ day=F$CVTIME(,,"day")
> > $ week=F$CVTIME(,,"weekday")
> > $ if ((week .eqs. "Sunday") .and. (day .gt. "14") .and. (day .lt.
> > "23") .and. (hour .eq. "12")) then goto dispara
> > $exit
> > $dispara:
> > $ mail/subj=" >>> Restarte o Server <<< " sys
> > $login:restart_server.txt "smtp%""schwa...@aaaaaaa.com.br"""
> > $exit[/color]
>[color=green]
> > Thanks a lot for your examples !- Hide quoted text -[/color]
>[color=green]
> > - Show quoted text -[/color]
>
> As was pointed out, you must use .GT. 14 and .LT. 22
>
> Why are you including (HOUR .EQ. 12) ???
>
> If you schedule the batch job to submit itself every morning then it
> will send the message each morning. If you need this to happen only
> during the noon hour then submit the job to run at noon.
>
> I would be concerned that by including (HOUR .EQ. 12) you might end up
> off schedule and not get the message being sent even though the day is
> the third Sunday.- Ocultar texto entre aspas -
>
> - Mostrar texto entre aspas -[/color]
In reality, this procedure will stay in a batch queue, running each 5
minutes.
If day=Sunday, 3rd Sunday, hour=12 than send me an e-mail.
Thank you.
On Aug 29, 7:58 pm, apogeusiste...@gmail.com wrote:[color=blue]
> On 29 ago, 21:37, FrankS <sapie...@noesys.com> wrote:
>[color=green]
> > On Aug 29, 6:47 pm, apogeusiste...@gmail.com wrote:[/color]
>[color=green][color=darkred]
> > > On 29 ago, 19:37, Ron Johnson <ron.l.john...@cox.net> wrote:[/color][/color]
>[color=green][color=darkred]
> > > > On 08/29/07 16:26, nitr...@gmail.com wrote:[/color][/color]
>[color=green][color=darkred]
> > > > > On Aug 29, 12:57 pm, apogeusiste...@gmail.com wrote:
> > > > >> Iīm looking for a command procedure to send a operatorīs message
> > > > >> if the day is the third sunday in the month.[/color][/color]
>[color=green][color=darkred]
> > > > > Basic idea (use account with OPER priv):[/color][/color]
>[color=green][color=darkred]
> > > > > $ if F$CVTIME(,,"weekday") .eqs. "Sunday"
> > > > > $ then
> > > > > $ day = F$CVTIME(,,"day")
> > > > > $ if day .gt. 14 .and. day .lt. 22 then reply/username=system"3rd
> > > > > sunday"
> > > > > $ endif
> > > > > $ submit /after=tomorrow 'F$ENVIRONMENT("procedure")[/color][/color]
>[color=green][color=darkred]
> > > > Does "week" start on the first day of the month, or ...[/color][/color]
>[color=green][color=darkred]
> > > > Never mind.[/color][/color]
>[color=green][color=darkred]
> > > > --
> > > > Ron Johnson, Jr.
> > > > Jefferson LA USA[/color][/color]
>[color=green][color=darkred]
> > > > Give a man a fish, and he eats for a day.
> > > > Hit him with a fish, and he goes away for good![/color][/color]
>[color=green][color=darkred]
> > > Maybe I need change the day from 22 to 23...[/color][/color]
>[color=green][color=darkred]
> > > $ set nover
> > > $ hour="''F$EXTRACT(12,2, F$TIME())'"
> > > $ day=F$CVTIME(,,"day")
> > > $ week=F$CVTIME(,,"weekday")
> > > $ if ((week .eqs. "Sunday") .and. (day .gt. "14") .and. (day .lt.
> > > "23") .and. (hour .eq. "12")) then goto dispara
> > > $exit
> > > $dispara:
> > > $ mail/subj=" >>> Restarte o Server <<< " sys
> > > $login:restart_server.txt "smtp%""schwa...@aaaaaaa.com.br"""
> > > $exit[/color][/color]
>[color=green][color=darkred]
> > > Thanks a lot for your examples !- Hide quoted text -[/color][/color]
>[color=green]
> > As was pointed out, you must use .GT. 14 and .LT. 22[/color]
>[color=green]
> > Why are you including (HOUR .EQ. 12) ???[/color]
>[color=green]
> > If you schedule the batch job to submit itself every morning then it
> > will send the message each morning. If you need this to happen only
> > during the noon hour then submit the job to run at noon.[/color]
>[color=green]
> > I would be concerned that by including (HOUR .EQ. 12) you might end up
> > off schedule and not get the message being sent even though the day is
> > the third Sunday.- Ocultar texto entre aspas -[/color]
>[color=green]
> > - Mostrar texto entre aspas -[/color]
>
> In reality, this procedure will stay in a batch queue, running each 5
> minutes.
> If day=Sunday, 3rd Sunday, hour=12 than send me an e-mail.
> Thank you.[/color]
I wondered about the (hour .eq. 12) too, but figured maybe there was
more to it than what was presented. You realize that if it checks
every 5 minutes, the hour will be 12 for probably 11 of the times you
check?
If we're going to get picky without changing the "if" logic, though,
I'd lose the goto and do:
$ if week .eqs. "Sunday" .and. day .gt. 14 .and. day .lt. 22 .and.
hour .eq. 12
$ then
$ mail/subj=" >>> Restarte o Server <<< " sys
$ login:restart_server.txt "smtp%""schwa...@aaaaaaa.com.br"""
$ endif
$exit
But, I'm not going to get picky about other folks coding techniques
given some of the spaghetti I've written:-)
There are of course other ways to compute the nth xday of the month,
and I'm sure we'll see some of them.
You could compute the date-time you want to do the "restart", check
and execute when you've reached or gone past that time, and compute
the next date-time within that conditional code stream.
On 29 ago, 22:18, Doug Phillips <dphil...@netscape.net> wrote:[color=blue]
> On Aug 29, 7:58 pm, apogeusiste...@gmail.com wrote:
>
>
>
>
>[color=green]
> > On 29 ago, 21:37, FrankS <sapie...@noesys.com> wrote:[/color]
>[color=green][color=darkred]
> > > On Aug 29, 6:47 pm, apogeusiste...@gmail.com wrote:[/color][/color]
>[color=green][color=darkred]
> > > > On 29 ago, 19:37, Ron Johnson <ron.l.john...@cox.net> wrote:[/color][/color]
>[color=green][color=darkred]
> > > > > On 08/29/07 16:26, nitr...@gmail.com wrote:[/color][/color]
>[color=green][color=darkred]
> > > > > > On Aug 29, 12:57 pm, apogeusiste...@gmail.com wrote:
> > > > > >> Iīm looking for a command procedure to send a operatorīs message
> > > > > >> if the day is the third sunday in the month.[/color][/color]
>[color=green][color=darkred]
> > > > > > Basic idea (use account with OPER priv):[/color][/color]
>[color=green][color=darkred]
> > > > > > $ if F$CVTIME(,,"weekday") .eqs. "Sunday"
> > > > > > $ then
> > > > > > $ day = F$CVTIME(,,"day")
> > > > > > $ if day .gt. 14 .and. day .lt. 22 then reply/username=system "3rd
> > > > > > sunday"
> > > > > > $ endif
> > > > > > $ submit /after=tomorrow 'F$ENVIRONMENT("procedure")[/color][/color]
>[color=green][color=darkred]
> > > > > Does "week" start on the first day of the month, or ...[/color][/color]
>[color=green][color=darkred]
> > > > > Never mind.[/color][/color]
>[color=green][color=darkred]
> > > > > --
> > > > > Ron Johnson, Jr.
> > > > > Jefferson LA USA[/color][/color]
>[color=green][color=darkred]
> > > > > Give a man a fish, and he eats for a day.
> > > > > Hit him with a fish, and he goes away for good![/color][/color]
>[color=green][color=darkred]
> > > > Maybe I need change the day from 22 to 23...[/color][/color]
>[color=green][color=darkred]
> > > > $ set nover
> > > > $ hour="''F$EXTRACT(12,2, F$TIME())'"
> > > > $ day=F$CVTIME(,,"day")
> > > > $ week=F$CVTIME(,,"weekday")
> > > > $ if ((week .eqs. "Sunday") .and. (day .gt. "14") .and. (day .lt.
> > > > "23") .and. (hour .eq. "12")) then goto dispara
> > > > $exit
> > > > $dispara:
> > > > $ mail/subj=" >>> Restarte o Server <<< " sys
> > > > $login:restart_server.txt "smtp%""schwa...@aaaaaaa.com.br"""
> > > > $exit[/color][/color]
>[color=green][color=darkred]
> > > > Thanks a lot for your examples !- Hide quoted text -[/color][/color]
>[color=green][color=darkred]
> > > As was pointed out, you must use .GT. 14 and .LT. 22[/color][/color]
>[color=green][color=darkred]
> > > Why are you including (HOUR .EQ. 12) ???[/color][/color]
>[color=green][color=darkred]
> > > If you schedule the batch job to submit itself every morning then it
> > > will send the message each morning. If you need this to happen only
> > > during the noon hour then submit the job to run at noon.[/color][/color]
>[color=green][color=darkred]
> > > I would be concerned that by including (HOUR .EQ. 12) you might end up
> > > off schedule and not get the message being sent even though the day is
> > > the third Sunday.- Ocultar texto entre aspas -[/color][/color]
>[color=green][color=darkred]
> > > - Mostrar texto entre aspas -[/color][/color]
>[color=green]
> > In reality, this procedure will stay in a batch queue, running each 5
> > minutes.
> > If day=Sunday, 3rd Sunday, hour=12 than send me an e-mail.
> > Thank you.[/color]
>
> I wondered about the (hour .eq. 12) too, but figured maybe there was
> more to it than what was presented. You realize that if it checks
> every 5 minutes, the hour will be 12 for probably 11 of the times you
> check?
>
> If we're going to get picky without changing the "if" logic, though,
> I'd lose the goto and do:
>
> $ if week .eqs. "Sunday" .and. day .gt. 14 .and. day .lt. 22 .and.
> hour .eq. 12
> $ then
> $ mail/subj=" >>> Restarte o Server <<< " sys
> $ login:restart_server.txt "smtp%""schwa...@aaaaaaa.com.br"""
> $ endif
> $exit
>
> But, I'm not going to get picky about other folks coding techniques
> given some of the spaghetti I've written:-)
>
> There are of course other ways to compute the nth xday of the month,
> and I'm sure we'll see some of them.
>
> You could compute the date-time you want to do the "restart", check
> and execute when you've reached or gone past that time, and compute
> the next date-time within that conditional code stream.- Ocultar texto entre aspas -
>
> - Mostrar texto entre aspas -[/color]
I made this change:
$ hour="''F$EXTRACT(12,4, F$TIME())'"
$ day=F$CVTIME(,,"day")
$ week=F$CVTIME(,,"weekday")
$ if ((week .eqs. "Sunday") .and. (day .gt. 14) .and. (day .lt.
22) .and. (hour .eq. "12:0")) then goto dispara
and Iīll receive only 2 alerts (maybe only 1)
Thanks.
In article <1188437058.314136.41760@57g2000hsv.googlegroups.com>, [email]apogeusistemas@gmail.com[/email] writes:[color=blue]
>
>
>On 29 ago, 22:18, Doug Phillips <dphil...@netscape.net> wrote:[color=green]
>> On Aug 29, 7:58 pm, apogeusiste...@gmail.com wrote:
>>
>>
>>
>>
>>[color=darkred]
>> > On 29 ago, 21:37, FrankS <sapie...@noesys.com> wrote:[/color]
>>[color=darkred]
>> > > On Aug 29, 6:47 pm, apogeusiste...@gmail.com wrote:[/color]
>>[color=darkred]
>> > > > On 29 ago, 19:37, Ron Johnson <ron.l.john...@cox.net> wrote:[/color]
>>[color=darkred]
>> > > > > On 08/29/07 16:26, nitr...@gmail.com wrote:[/color]
>>[color=darkred]
>> > > > > > On Aug 29, 12:57 pm, apogeusiste...@gmail.com wrote:
>> > > > > >> I=B4m looking for a command procedure to send a operator=B4s m=[/color][/color]
>essage[color=green][color=darkred]
>> > > > > >> if the day is the third sunday in the month.[/color]
>>[color=darkred]
>> > > > > > Basic idea (use account with OPER priv):[/color]
>>[color=darkred]
>> > > > > > $ if F$CVTIME(,,"weekday") .eqs. "Sunday"
>> > > > > > $ then
>> > > > > > $ day =3D F$CVTIME(,,"day")
>> > > > > > $ if day .gt. 14 .and. day .lt. 22 then reply/username=3Dsyst=[/color][/color]
>em "3rd[color=green][color=darkred]
>> > > > > > sunday"
>> > > > > > $ endif
>> > > > > > $ submit /after=3Dtomorrow 'F$ENVIRONMENT("procedure")[/color]
>>[color=darkred]
>> > > > > Does "week" start on the first day of the month, or ...[/color]
>>[color=darkred]
>> > > > > Never mind.[/color]
>>[color=darkred]
>> > > > > --
>> > > > > Ron Johnson, Jr.
>> > > > > Jefferson LA USA[/color]
>>[color=darkred]
>> > > > > Give a man a fish, and he eats for a day.
>> > > > > Hit him with a fish, and he goes away for good![/color]
>>[color=darkred]
>> > > > Maybe I need change the day from 22 to 23...[/color]
>>[color=darkred]
>> > > > $ set nover
>> > > > $ hour=3D"''F$EXTRACT(12,2, F$TIME())'"
>> > > > $ day=3DF$CVTIME(,,"day")
>> > > > $ week=3DF$CVTIME(,,"weekday")
>> > > > $ if ((week .eqs. "Sunday") .and. (day .gt. "14") .and. (day .lt.
>> > > > "23") .and. (hour .eq. "12")) then goto dispara
>> > > > $exit
>> > > > $dispara:
>> > > > $ mail/subj=3D" >>> Restarte o Server <<< " sys
>> > > > $login:restart_server.txt "smtp%""schwa...@aaaaaaa.com.br"""
>> > > > $exit[/color]
>>[color=darkred]
>> > > > Thanks a lot for your examples !- Hide quoted text -[/color]
>>[color=darkred]
>> > > As was pointed out, you must use .GT. 14 and .LT. 22[/color]
>>[color=darkred]
>> > > Why are you including (HOUR .EQ. 12) ???[/color]
>>[color=darkred]
>> > > If you schedule the batch job to submit itself every morning then it
>> > > will send the message each morning. If you need this to happen only
>> > > during the noon hour then submit the job to run at noon.[/color]
>>[color=darkred]
>> > > I would be concerned that by including (HOUR .EQ. 12) you might end up
>> > > off schedule and not get the message being sent even though the day is
>> > > the third Sunday.- Ocultar texto entre aspas -[/color]
>>[color=darkred]
>> > > - Mostrar texto entre aspas -[/color]
>>[color=darkred]
>> > In reality, this procedure will stay in a batch queue, running each 5
>> > minutes.
>> > If day=3DSunday, 3rd Sunday, hour=3D12 than send me an e-mail.
>> > Thank you.[/color]
>>
>> I wondered about the (hour .eq. 12) too, but figured maybe there was
>> more to it than what was presented. You realize that if it checks
>> every 5 minutes, the hour will be 12 for probably 11 of the times you
>> check?
>>
>> If we're going to get picky without changing the "if" logic, though,
>> I'd lose the goto and do:
>>
>> $ if week .eqs. "Sunday" .and. day .gt. 14 .and. day .lt. 22 .and.
>> hour .eq. 12
>> $ then
>> $ mail/subj=3D" >>> Restarte o Server <<< " sys
>> $ login:restart_server.txt "smtp%""schwa...@aaaaaaa.com.br"""
>> $ endif
>> $exit
>>
>> But, I'm not going to get picky about other folks coding techniques
>> given some of the spaghetti I've written:-)
>>
>> There are of course other ways to compute the nth xday of the month,
>> and I'm sure we'll see some of them.
>>
>> You could compute the date-time you want to do the "restart", check
>> and execute when you've reached or gone past that time, and compute
>> the next date-time within that conditional code stream.- Ocultar texto en=[/color]
>tre aspas -[color=green]
>>
>> - Mostrar texto entre aspas -[/color]
>
>
>I made this change:
>
>$ hour=3D"''F$EXTRACT(12,4, F$TIME())'"
>$ day=3DF$CVTIME(,,"day")
>$ week=3DF$CVTIME(,,"weekday")
>$ if ((week .eqs. "Sunday") .and. (day .gt. 14) .and. (day .lt.
>22) .and. (hour .eq. "12:0")) then goto dispara
>
>
>and I=B4ll receive only 2 alerts (maybe only 1)[/color]
You can avoid the two date compares with this BTW:
((day .gt. 14) .and. (day .lt.22)) == ((day-1)/7 .eq. 2)
--
VAXman- A Bored Certified VMS Kernel Mode Hacker VAXman(at)TMESIS(dot)COM
"Well my son, life is like a beanstalk, isn't it?"
[url]http://tmesis.com/drat.jpg[/url]
In article <1188417464.868176.206600@w3g2000hsg.googlegroups.com>, [email]apogeusistemas@gmail.com[/email] writes:[color=blue]
> Hi:
> I=B4m looking for a command procedure to send a operator=B4s message
> if the day is the third sunday in the month.
> Can you help me ?
> Thank you.
>[/color]
You could help us if you'ld post in ASCII so I don't have to guess
which character in which MS font encodes as =B4 in MIME.
In article <1188430398.401567.111110@k79g2000hse.googlegroups.com>, Doug Phillips <dphill46@netscape.net> writes:[color=blue]
> On Aug 29, 5:47 pm, apogeusiste...@gmail.com wrote:[/color]
[...][color=blue][color=green]
>> $ if ((week .eqs. "Sunday") .and. (day .gt. "14") .and. (day .lt.
>> "23") .and. (hour .eq. "12")) then goto dispara[/color]
>
> You don't want " " around numbers unless you first convert them to a
> string, and then you need to use .gts. and .lts. if you're comparing
> strings.[/color]
Technically, the quotation marks around the numbers are harmless.
They result in the numbers being treated as text literals. But
since the .GT. and .LT. operators are used, those text literals
are automatically converted to numeric before the comparison.
Stylistically, the quotation marks are jarring and are a choice that
tends to indicate a poor understanding of DCL.
In article <jx8k0mk7HMLS@eisner.encompasserve.org>,
[email]koehler@eisner.nospam.encompasserve.org[/email] (Bob Koehler) writes:[color=blue]
> In article <1188417464.868176.206600@w3g2000hsg.googlegroups.com>, [email]apogeusistemas@gmail.com[/email] writes:[color=green]
>> Hi:
>> I=B4m looking for a command procedure to send a operator=B4s message
>> if the day is the third sunday in the month.
>> Can you help me ?
>> Thank you.
>>[/color]
>
> You could help us if you'ld post in ASCII so I don't have to guess
> which character in which MS font encodes as =B4 in MIME.[/color]
Gee whiz Bob, is it really that hard to tell which character belongs
there? And the lack of them does nothing to obscure the original
intent of the message.
bill
--
Bill Gunshannon | de-moc-ra-cy (di mok' ra see) n. Three wolves
[email]bill@cs.scranton.edu[/email] | and a sheep voting on what's for dinner.
University of Scranton |
Scranton, Pennsylvania | #include <std.disclaimer.h>
On Aug 30, 8:25 am, bri...@encompasserve.org wrote:[color=blue]
> In article <1188430398.401567.111...@k79g2000hse.googlegroups.com>, Doug Phillips <dphil...@netscape.net> writes:
>[color=green]
> > On Aug 29, 5:47 pm, apogeusiste...@gmail.com wrote:[/color]
> [...][color=green][color=darkred]
> >> $ if ((week .eqs. "Sunday") .and. (day .gt. "14") .and. (day .lt.
> >> "23") .and. (hour .eq. "12")) then goto dispara[/color][/color]
>[color=green]
> > You don't want " " around numbers unless you first convert them to a
> > string, and then you need to use .gts. and .lts. if you're comparing
> > strings.[/color]
>
> Technically, the quotation marks around the numbers are harmless.
> They result in the numbers being treated as text literals. But
> since the .GT. and .LT. operators are used, those text literals
> are automatically converted to numeric before the comparison.
>
> Stylistically, the quotation marks are jarring and are a choice that
> tends to indicate a poor understanding of DCL.[/color]
Yes, I'm sure most of us have typo'ed something similar and later
found that it worked, but as you say, it isn't the "right" way to do
it.
[email]apogeusistemas@gmail.com[/email] writes:
[color=blue]
>Hi:
>I=B4m looking for a command procedure to send a operator=B4s message
>if the day is the third sunday in the month.
>Can you help me ?
>Thank you.[/color]
A more challenging version of this is, instead of DCL running every day
checking if today's date is the third Sunday, is some DCL that sets
a DCL symbol to the date of the (next) third Sunday, so that one can do a
$ SUBMIT/AFTER='DATE and have the submitted code run _only_ on the third
Sunday.
A related puzzle I saw a long time ago was DCL that submits a job to
run on the second to last day of the month, again, without running and
checking every day.
On Aug 30, 7:38 am, VAXman- @SendSpamHere.ORG wrote:[color=blue]
> In article <1188437058.314136.41...@57g2000hsv.googlegroups.com>, apogeusiste...@gmail.com writes:
>
>[color=green]
> >I made this change:[/color]
>[color=green]
> >$ hour=3D"''F$EXTRACT(12,4, F$TIME())'"
> >$ day=3DF$CVTIME(,,"day")
> >$ week=3DF$CVTIME(,,"weekday")
> >$ if ((week .eqs. "Sunday") .and. (day .gt. 14) .and. (day .lt.
> >22) .and. (hour .eq. "12:0")) then goto dispara[/color]
>[color=green]
> >and I=B4ll receive only 2 alerts (maybe only 1)[/color]
>
> You can avoid the two date compares with this BTW:
>
> ((day .gt. 14) .and. (day .lt.22)) == ((day-1)/7 .eq. 2)
>[/color]
If day .le. 14 would the second compare execute or not?
I wonder which (compares or math) would execute fastest and/or most
efficiently (not that a milli- or microsecond here or there should
really matter.) I don't have a timer with fine enough granularity at
hand & don't feel like writing one today. Displaying f$time() isn't
fine enough to give consistent results.
Just curious and wondered if someone knows.
On 31 ago, 13:11, Doug Phillips <dphil...@netscape.net> wrote:[color=blue]
> On Aug 30, 7:38 am, VAXman- @SendSpamHere.ORG wrote:
>
>
>
>
>[color=green]
> > In article <1188437058.314136.41...@57g2000hsv.googlegroups.com>, apogeusiste...@gmail.com writes:[/color]
>[color=green][color=darkred]
> > >I made this change:[/color][/color]
>[color=green][color=darkred]
> > >$ hour=3D"''F$EXTRACT(12,4, F$TIME())'"
> > >$ day=3DF$CVTIME(,,"day")
> > >$ week=3DF$CVTIME(,,"weekday")
> > >$ if ((week .eqs. "Sunday") .and. (day .gt. 14) .and. (day .lt.
> > >22) .and. (hour .eq. "12:0")) then goto dispara[/color][/color]
>[color=green][color=darkred]
> > >and I=B4ll receive only 2 alerts (maybe only 1)[/color][/color]
>[color=green]
> > You can avoid the two date compares with this BTW:[/color]
>[color=green]
> > ((day .gt. 14) .and. (day .lt.22)) == ((day-1)/7 .eq. 2)[/color]
>
> If day .le. 14 would the second compare execute or not?
>
> I wonder which (compares or math) would execute fastest and/or most
> efficiently (not that a milli- or microsecond here or there should
> really matter.) I don't have a timer with fine enough granularity at
> hand & don't feel like writing one today. Displaying f$time() isn't
> fine enough to give consistent results.
>
> Just curious and wondered if someone knows.- Ocultar texto entre aspas -
>
> - Mostrar texto entre aspas -[/color]
Thanks to all.
Can you recomend any book or web site where find
time algorithms ? Every time I need stuff like this.
In article <fb9c17$9l4$1@pcls4.std.com>, [email]moroney@world.std.spaamtrap.com[/email] (Michael Moroney) writes:[color=blue]
> [email]apogeusistemas@gmail.com[/email] writes:
>[color=green]
>>Hi:
>>I=B4m looking for a command procedure to send a operator=B4s message
>>if the day is the third sunday in the month.
>>Can you help me ?
>>Thank you.[/color]
>
> A more challenging version of this is, instead of DCL running every day
> checking if today's date is the third Sunday, is some DCL that sets
> a DCL symbol to the date of the (next) third Sunday, so that one can do a
> $ SUBMIT/AFTER='DATE and have the submitted code run _only_ on the third
> Sunday.[/color]
$ date = f$time()
$ third_sunday = f$fao("!2ZL",21-f$locate(f$extract(0,2,f$cvtime("1"+f$extract(2,9,f$cvtime(date,"ABSOLUTE","DATE")),,"WEEKDAY")),"MoTuWeThFrSa")/2)+f$extract(2,9,f$cvtime(date,"ABSOLUTE","DATE"))
Algorithm:
Take the given date, put it into canonical format with f$cvtime,
change the day number to 1 and find the weekday of the first of the
month using f$cvtime.
Trim that down to 2 characers with f$extract, locate it in a lookup
table (trimmed so that "Su" is last and need not be in the table)
and divide by 2, giving the day number of the first of the month
using the convention that Monday = 0 and Sunday = 6
Subtract that from 21 giving the day number of the third Sunday,
zero fill using F$FAO (not really required for third sunday and not
part of problem requirements) and tack on the rest of the date string
for the given month, obtained with f$cvtime.
Note that if date is set to "TODAY" or "" there is a potential race
condition at midnight on the last day of the month since there
are two calls to CVTIME to get a date string corresponding to
the current month. That's the main reason that the solution
has two lines instead of one.
I'm not happy about a lookup table, but can't think of a handy way
to get a numeric day-of-week in DCL otherwise. (Yes, I know you
can get there with a mathematical formula based on numeric year,
month and day and can obtain all three from f$cvtime(,"COMPARISON"))
[color=blue]
> A related puzzle I saw a long time ago was DCL that submits a job to
> run on the second to last day of the month, again, without running and
> checking every day.[/color]
That sounds like a fairly easy one.
Find the date of the first day of this month (replace the day in
today's date with with "01")
Find a date in the next month (add 31 days with f$cvtime)
Find the first day of next month (replace the day with "01")
Find the date two days prior (subtract 2 days with f$cvtime)
No race conditions or table lookups in that one. Dead easy.