Page 1 of 1

how to check date before job running

Posted: Mon Jul 12, 2010 9:32 pm
by yimwai
when transforming stored procedure to datastage,I'm confused with codes like:
"IF day(I_Date) <> 4 THEN return 0;END IF;"
so I wannar check whether it's a right day to run the job.
IF NOT ,the job should be returned immediately.

Although the scheduler in director can point the exact day,I still wannar to check in the job in case of wrong scheduling.
please help!

Posted: Mon Jul 12, 2010 9:40 pm
by chulett
Can you not discuss your confusion with regards to the stored procedure with whomever wrote it? If not them, then whomever has taken over support of it?

You want to check in the job and then do what if the day is wrong? In my opinion, that check should be done in a Sequence job and then only run the processing job if it is the correct day, if not then skip the run and possibly send out an email notification to that fact. Schedule the Sequence job, not the actual processing job.

Posted: Mon Jul 12, 2010 9:57 pm
by yimwai
use a nested condition stage?

Posted: Mon Jul 12, 2010 10:13 pm
by chulett
You could, I suppose... but the answer could be as simple as two triggers coming from whatever checks the date, a Routine Activity as one example. One trigger is the 'success / thumbs up / why it *is* the right day' trigger and goes to a Job Activity stage and the other is a 'thumbs down' trigger that goes to a Notification Activity stage or may not exist at all if you just literally want to 'do nothing' in that case.

Posted: Mon Jul 12, 2010 10:31 pm
by ray.wurlod
The expression you mentioned seems to be relying on the ordinal position of the day in the week, that is day #4. You can generate expressions that return the day name (Oconv(@DATE,"DWA")) or day name abbreviation (Oconv(@DATE,"DWB")) or day number in week (Oconv(@DATE, "DD")) if you prefer. As to which is the "right" day - that's likely to be a local business rule, implemented as a constant in the expression, for example Oconv(@DATE,"DWB") = "WED"

Posted: Mon Jul 12, 2010 11:22 pm
by yimwai
how to check the whether the day is #4 . which param in (Oconv(@DATE,"????")) can return the day of month.
as (Oconv(@DATE,"DWA")) return the day of week

Posted: Mon Jul 12, 2010 11:27 pm
by yimwai
I got it
(Oconv(@DATE,"DD")) ='4'
thanks all