Calculate the previous business date using a calendar

Everything about Control-M Server installation or setup.
Post Reply
pbabka

Calculate the previous business date using a calendar

Post by pbabka » 03 Jun 2011 9:51

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

User avatar
gglau
Nouveau
Nouveau
Posts: 317
Joined: 13 Jun 2007 12:00

Post by gglau » 03 Jun 2011 11:41

%%PREV and %%NEXT will give a job's previous and next schedule day respectively. If this job is scheduled for business days only, these variables will give what you want.

pbabka

Post by pbabka » 06 Jun 2011 6:34

Hello,

Thanks, it's working.
But what can I do if I would like to know the "today minus Nth" working day?

In the Control-M for z/OS there was a good autoedit function to calculate this.

Thx.

Peter

User avatar
gglau
Nouveau
Nouveau
Posts: 317
Joined: 13 Jun 2007 12:00

Post by gglau » 06 Jun 2011 8:19

This is one of the features that are lacking in the Distributed side of the house.

User avatar
webDevGuru
Nouveau
Nouveau
Posts: 9
Joined: 09 Oct 2007 12:00

Hello gglau,

Post by webDevGuru » 09 Jun 2011 5:19

:idea: you can do "today - nth day" as below,

%PARM1 set it to %%$CALCDATE %%$ODATE-1

let me know if that works!

Cheers!
Sam

pbabka

Post by pbabka » 09 Jun 2011 8:22

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

User avatar
webDevGuru
Nouveau
Nouveau
Posts: 9
Joined: 09 Oct 2007 12:00

Hello

Post by webDevGuru » 09 Jun 2011 9:21

@pbabka, if its calendar then it should work as below

%PARM1 set %%$CALCDATE %%$ODATE - %%PREV


??

User avatar
Eight
Nouveau
Nouveau
Posts: 41
Joined: 03 May 2010 12:00

Post by Eight » 09 Jun 2011 8:04

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

User avatar
lex2000
Nouveau
Nouveau
Posts: 2
Joined: 27 Jul 2011 12:00

Post by lex2000 » 27 Jul 2011 10:47

This is my problem too, thanks for the suggestions.

Post Reply