how to check date before job running

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
yimwai
Participant
Posts: 46
Joined: Thu Jul 01, 2010 9:34 pm

how to check date before job running

Post 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!
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

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

"You can never have too many knives" -- Logan Nine Fingers
yimwai
Participant
Posts: 46
Joined: Thu Jul 01, 2010 9:34 pm

Post by yimwai »

use a nested condition stage?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

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

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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"
Last edited by ray.wurlod on Tue Jul 13, 2010 1:18 am, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
yimwai
Participant
Posts: 46
Joined: Thu Jul 01, 2010 9:34 pm

Post 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
yimwai
Participant
Posts: 46
Joined: Thu Jul 01, 2010 9:34 pm

Post by yimwai »

I got it
(Oconv(@DATE,"DD")) ='4'
thanks all
Post Reply