Navaneeth,
First in Dialogue Manager (DM) all variable are strings, so 20080616 can be a representation of a date or it could be a number. Now routines like DATEADD and DATEMOV only work with smart dates so the first thing I do is convert the current date (&YYMD=20080616) to a smart date. We do that with:
DATECVT(&YYMD,'I8YYMD','YYMD')
Next, I use DATEMOV to change the date to the 1st day of the month
DATEMOV(DATECVT(&YYMD,'I8YYMD','YYMD'),'BOM')
Then I add 2 business days
DATEADD(DATEMOV(DATECVT(&YYMD,'I8YYMD','YYMD'),'BOM'),'BD',2)
Finally, I convert the smart date back to a string that DM understands
DATECVT(DATEADD(DATEMOV(DATECVT(&YYMD,'I8YYMD','YYMD'),'BOM'),'BD',2),'YYMD','I8YYMD');
What I have done is use the current date to find the 3rd business day of month. I then compare that date to the current date. If the are the same, the current date is the 3rd business day the -SET is skipped and the job runs. If they are not the same, then I set &&KILL_RPC to 'Y' and Report Caster kills the job. &&KILL_RPC is a System Global Variable.
Note that when using business days, if you use a holiday file, that will be taken into account. For example, this year, Sep 1st is a holiday in the USA, so the 3rd business day is the 4th. If you don't use a holdiday file, the 3rd business day is the 3rd. In August, the 3rd business day is the 5th.
The other thing to keep in mind is that if a job has multilple tasks, each task has to execute the pre-processing fex to keep it from running.
Sorry that I cannot help more, but I still don't understand your requirement. You need the answers to the following questions:
- When is the job going to run? What is the schedule? Is it something like Monday at 1am?
- When it runs, what is the time period? Is it the previous week? month? Monday-Friday?
- How is the time period determined? Is it input from a screen? Can it be computed from the current date?
In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.