Hi Everybody,
Can I calculate a previous business date using a calendar and store it an autoedit variable?
E.g. I would like to get 20110603 when I ask the previous date on Monday, 20110606, if the Saturday and Sunday are not business days.
Thx.
Regards,
Peter
Calculate the previous business date using a calendar
- webDevGuru
- Nouveau
- Posts: 9
- Joined: 09 Oct 2007 12:00
Hello gglau,
you can do "today - nth day" as below,
%PARM1 set it to %%$CALCDATE %%$ODATE-1
let me know if that works!
Cheers!
Sam
%PARM1 set it to %%$CALCDATE %%$ODATE-1
let me know if that works!
Cheers!
Sam
Hello webDevGuru,
Yes, it's working, but it is doing something different.
It returns the previous day regardless to the job's scheduling criterias.
Pls imagine the followings:
There is a job which can run Monday to Friday except the public holidays.
Suppose that, on Tuesday is a public holiday. On Wednesday I would like to know which was the -2nd WORKING day. In this case the previous working day was Monday, the 2nd was Friday.
Regards,
Peter
Yes, it's working, but it is doing something different.
It returns the previous day regardless to the job's scheduling criterias.
Pls imagine the followings:
There is a job which can run Monday to Friday except the public holidays.
Suppose that, on Tuesday is a public holiday. On Wednesday I would like to know which was the -2nd WORKING day. In this case the previous working day was Monday, the 2nd was Friday.
Regards,
Peter
- webDevGuru
- Nouveau
- Posts: 9
- Joined: 09 Oct 2007 12:00
Hello
@pbabka, if its calendar then it should work as below
%PARM1 set %%$CALCDATE %%$ODATE - %%PREV
??
%PARM1 set %%$CALCDATE %%$ODATE - %%PREV
??
Hey,
I just tested this out (Control-M 6.4 distributed) and it seems to do what you need... you assign a global variable...
%%\abcdate = %%$PREV
(Note the ‘$’ to give it a 4 digit year and ‘\’ to make it global)
• First I set up a calendar that had today and the previous date of June 03.
• I then set the command to echo %%abcdate and got this output: 20110603
I just tested this out (Control-M 6.4 distributed) and it seems to do what you need... you assign a global variable...
%%\abcdate = %%$PREV
(Note the ‘$’ to give it a 4 digit year and ‘\’ to make it global)
• First I set up a calendar that had today and the previous date of June 03.
• I then set the command to echo %%abcdate and got this output: 20110603