Page 1 of 2

To run a job based on the output of the first job

Posted: Wed Oct 13, 2010 5:29 am
by adityavarma
Hi,

I have an requirement where in i need to run the job2 based on the output value of the column of the job1.

Job1 --> Job 2


Can anyone please help me on this.

Posted: Wed Oct 13, 2010 6:07 am
by ArndW
Could you specify the problem a bit more, since generally a job processes more than one record, and thus each column can have many values.
Generally you could make a constraint in a transform stage which either creates a text file with the value you want, or could set the user status to that value, which a sequence can pick up and pass to the second job.

Posted: Wed Oct 13, 2010 6:23 am
by adityavarma
In my first job i have source as oracle table i need to execute a sql query to find out the value of the column in that table, that value will be success or aborted, if the value is aborted the next job should not start and if the value is success then the next job should be initiated.

Regards,
Aditya

Posted: Wed Oct 13, 2010 6:44 am
by ArndW
You can write a job sequence which only executes job 2 if job 1 finishes successfully. In your example, Job 1 would abort and thus Job 2 will not run; so you don't need to know the value of any columns.

Posted: Wed Oct 13, 2010 7:02 am
by adityavarma
In my case, the job 1 will always be successfull.
In the job1 i am writing a column into a dataset file
i am fetching the column1 value from the oracle table.

Column1
======
Success or aborted.

If the column1 value is "aborted" then the main sequence should abort. if the column1 value is "success" then the job2 should start.

MAin seq

job1 --> job2

Posted: Wed Oct 13, 2010 7:32 am
by chulett
Write it to something simple, a flat file for instance. Then an Execute Command stage can 'cat/read' the value and your triggers can decide to run Job2 or not based on the result.

Posted: Wed Oct 13, 2010 8:12 am
by adityavarma
Hi Chulett/Andrw

Thanks for the reply,

Now i got how to proceed on this,
but i am stuck in the execute command triggers to start or abort the job.

If Trim(Execute_Command_22.$CommandOutput) = 'SUCCESS' Then Else

I am unable to get which command to use to start the next job if the output is success and to abort the job if the status is aborted.

Posted: Wed Oct 13, 2010 8:23 am
by chulett
Success trigger could be just Trim(Execute_Command_22.$CommandOutput) = 'SUCCESS' while for the abort an 'Otherwise' trigger would work.

Posted: Wed Oct 13, 2010 9:14 am
by adityavarma
Craig,

I have kept the below code but still the job2 is not been triggered
Trim(Exec_column.$CommandOutput) = "SUCCESS"

then i have link to the job2 and otehr wise link to the terminator activity

The job1 is finished succesfully but the job2 is not ben initiated.


JOb1 --> executecmd --> job2
|
V
terminator activity

Posted: Wed Oct 13, 2010 9:50 am
by chulett
Confirm for us the command you are executing. That and try this as the success trigger: Execute_Command_22.$CommandOutput<1>) = "SUCCESS"

Posted: Wed Oct 13, 2010 9:59 am
by adityavarma
The Command i am executing in the execute command acitivity is
Command: cat
Parameters: <filename>

Posted: Wed Oct 13, 2010 11:53 am
by vinothkumar
Can you check the output for the command you executed from director log .

Posted: Wed Oct 13, 2010 3:43 pm
by chulett
That's what I assumed, the trigger I gave you should work as it "removes" the Field Mark that is in the output. You could also use EReplace() for that.

Posted: Wed Oct 13, 2010 10:49 pm
by adityavarma
I am not able to find any output in the director log for the execute command activity.

i have used Exec_DAILY_SALES_BATCH_STATUS.$CommandOutput <1>= "SUCCESS"

But still the next job is not been intiated.

Posted: Thu Oct 14, 2010 12:10 am
by adityavarma
Sorry , My mistake and it is a very silly one

I have kept the trigger as
job_name.$JobStatus=2 Or job_name_Load.$JobStatus =3 and have send the link to execute command acitivity for which the trigger only will execute the command activity only if the job1 is aborted,but the job is running successfully, so the execute command acitivity is not been triggered.

I have executed the below triggers

Exec_DAILY_SALES_BATCH_STATUS.$CommandOutput<1>="SUCCESS"

Trim(Exec_DAILY_SALES_BATCH_STATUS.$CommandOutput)<1>= "SUCCESS"

Trim(Ereplace(Exec_DAILY_SALES_BATCH_STATUS.$CommandOutput,"'","") )


For all the above triggers the

Reply=0
Output from command ====>
"SUCCESS"

but still the main sequence is aborting.


I have found out one more issue, i have created a parameter set for all the jobs , but i am unable to find the parameters in the execute command acitivity.


Regards,
Aditya