Third sunday in the month - VMS

This is a discussion on Third sunday in the month - VMS ; 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....

+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 20 of 26

Thread: Third sunday in the month

  1. Third sunday in the month

    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.


  2. Re: Third sunday in the month

    On 08/29/07 14:57, apogeusistemas@gmail.com wrote:
    > 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 ?


    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!

  3. Re: Third sunday in the month

    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.


    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


  4. Re: Third sunday in the month

    On 08/29/07 16:26, nitromh@gmail.com wrote:
    > 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.

    >
    > 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")


    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!

  5. Re: Third sunday in the month

    On 29 ago, 19:37, Ron Johnson wrote:
    > On 08/29/07 16:26, nitr...@gmail.com wrote:
    >
    > > 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.

    >
    > > 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")

    >
    > 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!


    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 !



  6. Re: Third sunday in the month

    On Aug 29, 5:47 pm, apogeusiste...@gmail.com wrote:
    > > On 08/29/07 16:26, nitr...@gmail.com wrote:

    >
    > > > 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.

    >
    > > > 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")

    >
    > Maybe I need change the day from 22 to 23...


    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.

    >
    > $ 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


    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.

    > $exit
    > $dispara:
    > $ mail/subj=" >>> Restarte o Server <<< " sys
    > $login:restart_server.txt "smtp%""schwa...@aaaaaaa.com.br"""
    > $exit
    >
    > Thanks a lot for your examples !




  7. Re: Third sunday in the month

    On Aug 29, 3:57 pm, apogeusiste...@gmail.com wrote:
    > 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.


    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, http://www.rlgsc.com


  8. Re: Third sunday in the month

    On Aug 29, 6:47 pm, apogeusiste...@gmail.com wrote:
    > On 29 ago, 19:37, Ron Johnson wrote:
    >
    >
    >
    >
    >
    > > On 08/29/07 16:26, nitr...@gmail.com wrote:

    >
    > > > 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.

    >
    > > > 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")

    >
    > > 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!

    >
    > 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 -


    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.


  9. Re: Third sunday in the month

    On 29 ago, 21:37, FrankS wrote:
    > On Aug 29, 6:47 pm, apogeusiste...@gmail.com wrote:
    >
    >
    >
    >
    >
    > > On 29 ago, 19:37, Ron Johnson wrote:

    >
    > > > On 08/29/07 16:26, nitr...@gmail.com wrote:

    >
    > > > > 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.

    >
    > > > > 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")

    >
    > > > 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!

    >
    > > 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 -

    >
    > 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 -


    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.


  10. Re: Third sunday in the month

    On Aug 29, 7:58 pm, apogeusiste...@gmail.com wrote:
    > On 29 ago, 21:37, FrankS wrote:
    >
    > > On Aug 29, 6:47 pm, apogeusiste...@gmail.com wrote:

    >
    > > > On 29 ago, 19:37, Ron Johnson wrote:

    >
    > > > > On 08/29/07 16:26, nitr...@gmail.com wrote:

    >
    > > > > > 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.

    >
    > > > > > 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")

    >
    > > > > 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!

    >
    > > > 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 -

    >
    > > 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 -

    >
    > 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.


    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.



  11. Re: Third sunday in the month

    On 29 ago, 22:18, Doug Phillips wrote:
    > On Aug 29, 7:58 pm, apogeusiste...@gmail.com wrote:
    >
    >
    >
    >
    >
    > > On 29 ago, 21:37, FrankS wrote:

    >
    > > > On Aug 29, 6:47 pm, apogeusiste...@gmail.com wrote:

    >
    > > > > On 29 ago, 19:37, Ron Johnson wrote:

    >
    > > > > > On 08/29/07 16:26, nitr...@gmail.com wrote:

    >
    > > > > > > 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.

    >
    > > > > > > 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")

    >
    > > > > > 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!

    >
    > > > > 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 -

    >
    > > > 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 -

    >
    > > 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.

    >
    > 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 -



    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.


  12. Re: Third sunday in the month

    In article <1188437058.314136.41760@57g2000hsv.googlegroups.co m>, apogeusistemas@gmail.com writes:
    >
    >
    >On 29 ago, 22:18, Doug Phillips wrote:
    >> On Aug 29, 7:58 pm, apogeusiste...@gmail.com wrote:
    >>
    >>
    >>
    >>
    >>
    >> > On 29 ago, 21:37, FrankS wrote:

    >>
    >> > > On Aug 29, 6:47 pm, apogeusiste...@gmail.com wrote:

    >>
    >> > > > On 29 ago, 19:37, Ron Johnson wrote:

    >>
    >> > > > > On 08/29/07 16:26, nitr...@gmail.com wrote:

    >>
    >> > > > > > On Aug 29, 12:57 pm, apogeusiste...@gmail.com wrote:
    >> > > > > >> I=B4m looking for a command procedure to send a operator=B4s m=

    >essage
    >> > > > > >> if the day is the third sunday in the month.

    >>
    >> > > > > > Basic idea (use account with OPER priv):

    >>
    >> > > > > > $ if F$CVTIME(,,"weekday") .eqs. "Sunday"
    >> > > > > > $ then
    >> > > > > > $ day =3D F$CVTIME(,,"day")
    >> > > > > > $ if day .gt. 14 .and. day .lt. 22 then reply/username=3Dsyst=

    >em "3rd
    >> > > > > > sunday"
    >> > > > > > $ endif
    >> > > > > > $ submit /after=3Dtomorrow 'F$ENVIRONMENT("procedure")

    >>
    >> > > > > 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!

    >>
    >> > > > Maybe I need change the day from 22 to 23...

    >>
    >> > > > $ 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

    >>
    >> > > > Thanks a lot for your examples !- Hide quoted text -

    >>
    >> > > 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 -

    >>
    >> > 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.

    >>
    >> 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=

    >tre aspas -
    >>
    >> - Mostrar texto entre aspas -

    >
    >
    >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)


    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?"

    http://tmesis.com/drat.jpg

  13. Re: Third sunday in the month

    In article <1188417464.868176.206600@w3g2000hsg.googlegroups.c om>, apogeusistemas@gmail.com writes:
    > 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.
    >


    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.


  14. Re: Third sunday in the month

    In article <1188430398.401567.111110@k79g2000hse.googlegroups. com>, Doug Phillips writes:
    > On Aug 29, 5:47 pm, apogeusiste...@gmail.com wrote:

    [...]
    >> $ if ((week .eqs. "Sunday") .and. (day .gt. "14") .and. (day .lt.
    >> "23") .and. (hour .eq. "12")) then goto dispara

    >
    > 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.


    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.

  15. Re: Third sunday in the month

    In article ,
    koehler@eisner.nospam.encompasserve.org (Bob Koehler) writes:
    > In article <1188417464.868176.206600@w3g2000hsg.googlegroups.c om>, apogeusistemas@gmail.com writes:
    >> 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.
    >>

    >
    > 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.


    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
    bill@cs.scranton.edu | and a sheep voting on what's for dinner.
    University of Scranton |
    Scranton, Pennsylvania | #include

  16. Re: Third sunday in the month

    On Aug 30, 8:25 am, bri...@encompasserve.org wrote:
    > In article <1188430398.401567.111...@k79g2000hse.googlegroups. com>, Doug Phillips writes:
    >
    > > On Aug 29, 5:47 pm, apogeusiste...@gmail.com wrote:

    > [...]
    > >> $ if ((week .eqs. "Sunday") .and. (day .gt. "14") .and. (day .lt.
    > >> "23") .and. (hour .eq. "12")) then goto dispara

    >
    > > 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.

    >
    > 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.


    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.


  17. Re: Third sunday in the month

    apogeusistemas@gmail.com writes:

    >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.


    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.

  18. Re: Third sunday in the month

    On Aug 30, 7:38 am, VAXman- @SendSpamHere.ORG wrote:
    > In article <1188437058.314136.41...@57g2000hsv.googlegroups.co m>, apogeusiste...@gmail.com writes:
    >
    >
    > >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)

    >
    > You can avoid the two date compares with this BTW:
    >
    > ((day .gt. 14) .and. (day .lt.22)) == ((day-1)/7 .eq. 2)
    >


    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.


  19. Re: Third sunday in the month

    On 31 ago, 13:11, Doug Phillips wrote:
    > On Aug 30, 7:38 am, VAXman- @SendSpamHere.ORG wrote:
    >
    >
    >
    >
    >
    > > In article <1188437058.314136.41...@57g2000hsv.googlegroups.co m>, apogeusiste...@gmail.com writes:

    >
    > > >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)

    >
    > > You can avoid the two date compares with this BTW:

    >
    > > ((day .gt. 14) .and. (day .lt.22)) == ((day-1)/7 .eq. 2)

    >
    > 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 -


    Thanks to all.
    Can you recomend any book or web site where find
    time algorithms ? Every time I need stuff like this.



  20. Re: Third sunday in the month

    In article , moroney@world.std.spaamtrap.com (Michael Moroney) writes:
    > apogeusistemas@gmail.com writes:
    >
    >>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.

    >
    > 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.


    $ 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"))

    > 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.


    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.

+ Reply to Thread
Page 1 of 2 1 2 LastLast