Automate to run 3 jobs as and when available.

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
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

Hi Manoj,
If your source file is different for all three jobs,then in my view you need to create three different sequences with many loops.

Code: Select all

startloop----> waitforfile------>JobA ---->ExecCommand---->EndLoop
startloop----> waitforfile------>JobB  --->ExecCommand---->EndLoop
startloop----> waitforfile------>JobC  --->ExecCommand---->EndLoop
You have to run this loop always.Setting in startloop will be:-

LoopType=Numeric Loop
Loop definition:-
From-1
Step-1
To-9999999

Waitforfile will look that if mentioned file is present or not,as soon as its present there it will trigger your job.

After your job is finished,you have to move file to archieve folder or some archival approach you need to apply.
In case of job failuar,you need to handle what exactly you want to do after that.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I know you're not looking for an answer of this nature but in my mind this is where a decent Enterprise Scheduling tool would come in handy.
-craig

"You can never have too many knives" -- Logan Nine Fingers
hi_manoj
Participant
Posts: 56
Joined: Sat Aug 13, 2011 2:00 pm
Location: BLR

Post by hi_manoj »

Hi All,
Prasson, Thanks a lot for you effort, can this be done in one sequence if not I will convince them to have 3 seq one for each job

startloop----> waitforfile------>JobA ---->ExecCommand---->EndLoop

I want to run the job between 6 am to 8 pm.
As per your approach the job will start and it will wait for the file (say for 15 min) and it find the file and run the Job A, archive the file, goes to endloop and again comes back to sartloop . Suppose for next 15 min it did not find the file, here i want the job should not stop and directly goes to endloop and comes back to startloop (it should not try to run Job A)

This process will continue till 8 pm and the end it will send a mail saying how many times the job A rune for that day.

Please suggest a approach.

Regards
Manoj
Manoj
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

Hi,
As Chulett suggested,you should need a enterprise scheduling tool.If you are using scheduling tool,you can schedule your sequence to run between 6AM to 8PM .
In case you dont have any scheduling tool,you can probably explore "crontab" command on unix box.

If you dont want to make your job dependent on file,then why dont you trigger your job for every 15 mint and pass unique Invocation id (make your job run on multiple instence) for every run.In this case you dont need start and end loop activity.
At last you need to count the number of invocation_id you passed to the job and send it through a mail.
hi_manoj
Participant
Posts: 56
Joined: Sat Aug 13, 2011 2:00 pm
Location: BLR

Post by hi_manoj »

Hi,

I have design the sequence (each for a job) and it looks like this.

Code: Select all

startloop --> filewatcher --> job A 
     |           |           |
     |           |           |
endloop <-- sequencer <--- Archive
but now the issue is whenever i run the job it only goes to sequence (down). It does not cones to Job A, if the file is present in the directory.

I have tried to change the triggers but no luck. Any think i am missing.

Regards
Manoj
Manoj
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Detail for us how your FileWatcher is configured and what your trigger expressions are that come from it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
hi_manoj
Participant
Posts: 56
Joined: Sat Aug 13, 2011 2:00 pm
Location: BLR

Post by hi_manoj »

Hi All,

I am trying a approach with 3 waitforfile stage. Once it is i will share the flow.
Thanks you very much for all your help.

Regards
Manoj
Manoj
Post Reply