Job needs to run each hour

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
_chamak
Premium Member
Premium Member
Posts: 29
Joined: Tue Aug 24, 2010 10:29 am

Job needs to run each hour

Post by _chamak »

Hi,

We have a requirement to start the jobs only the users update a column to 'Y' in a table. Can you tell me how can we achieve this.

On every last day of the month our business team updates a column in a table to 'Y' then our autosys job needs to run. I think file watcher will work for Datastage job. ANyone has any idea how we can achieve this
-Thanks
Chamak
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You can't use a File Watcher to do this, at least not directly. You'll need something to poll the table for a column that is newly set to 'Y' (I suggest a Server job) and then you'll need to check to see if it successfully found a row. At that point you'll need to do two things, 1) mark the row as processed so it doesn't trigger anything again at the next polling time (prefer this to deleting so you have a record, we generally timestamp the detection time) and then 2) trigger the dependent job(s).

Now, that could be as simple as writing out a 'go' file as the target in the polling job and then a File Watcher elsewhere could watch for that file. Or you could get a LinkCount from the polling job to see that it find a number of records not equal to zero and then trigger the dependent job(s).

Question - once you find the 'Y in a table', then what? Meaning how exactly will you be triggering AutoSys? Do you already have a script for that?
-craig

"You can never have too many knives" -- Logan Nine Fingers
MT
Premium Member
Premium Member
Posts: 198
Joined: Fri Mar 09, 2007 3:51 am

Re: Job needs to run each hour

Post by MT »

Hi _chamak

you could write a database trigger "on update" of that column. Then you check if it is set to 'Y' within the trigger and run a user defined function.
That UDF could then execute a OS command which runs dsjob to start the DataStage sequence (or job).
regards

Michael
_chamak
Premium Member
Premium Member
Posts: 29
Joined: Tue Aug 24, 2010 10:29 am

Post by _chamak »

Hi Chullet, Thanks for the reply. I cant use a server job. I can create a job and load it to a flat file but autosys needs to run the job every 30 min. I dont think Autosys will work calling the job and every 30 min and stop running it after it see a Y in the table.

I dont have a script so looking for script and ideas how I can achive this.
-Thanks
Chamak
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

_chamak wrote:I cant use a server job.
Sure you can. Doing something like that in a Parallel job borders on the ridiculous. Use the right tool for the job.

Why would it need to stop running it after it finds a 'Y'? Sure it makes sense to stop but it wouldn't hurt anything to run it over the course of the day either.

All of this is predicated on you being able to trigger AutoSys... have you worked with them to know how to do this? If your scheduler already runs DataStage jobs then you've already got that covered, it could just do the File Watch directly every 30 and trigger when it sees the semaphore file you create. Be it by trigger or DataStage job.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply