Page 1 of 1

Need to use date to run certain jobs in a Sequence

Posted: Mon Jul 15, 2013 8:49 pm
by raji33
Hi All,

I have a requirement where i need to pass date parameter.
for ex: Date parameter '07/15/2013'
table1 have below columns

field1,
field2,
field3,
field4,
-
-
field14

and i have two jobs

job 1: extracts field 1 to field 10 from table 1 to target file
job 2 : extracts field 5 to field 14 from table 1 to target file
if date falls in (1-5) then pick job 1 else if the date falls above 5 then pick job2. In the example the date is 15 so i need to pick job 2.

Any ideas will be appreciated.

Thanks

Posted: Mon Jul 15, 2013 9:47 pm
by ray.wurlod
Use a sequence to test the date parameter, and decide which job (or what parameters for a single job) to be used based on that trigger.

Posted: Tue Jul 16, 2013 9:42 am
by raji33
Hi Ray,

This is the trigger condition i am using in sequence under job activity.
for ex: 07-16-2013 is the date parameter and its not between (02,05) dates so it has to pick the job2

if (evdate[4,2] <='02' and evdate[4,2] <= '05') then job1.$JobName else job2.$JobName

sequence is getting aborted.
Not sure where i am going wrong.

Thanks
Raji

Posted: Tue Jul 16, 2013 11:04 am
by chulett
You can't do "assignments" in trigger expressions. An trigger expression evaluates to TRUE or FALSE so use two triggers to two different Job Activity stages, one for each job with the proper range check in them:

Job1: evdate[4,2] >='02' and evdate[4,2] <= '05
Job2: evdate[4,2] < '02' or evdate[4,2] > '05

An 'Otherwise' trigger would work just as well for the second one.

Posted: Tue Jul 16, 2013 11:50 am
by raji33
Thanks Chulett.

Sequence is working fine. but if i pass '07-03-2013' how ever i change data parameter it is just running one job not the other one.

i am using data parametr evdate as string in properties.
below is my job design
nestedcondition activity------------------job1
!
!--------------------job2
in first condition i have provided evdate[4,2] >='02' and evdate[4,2] <= '05 otherwise for job2 in nested activity.

Posted: Tue Jul 16, 2013 2:06 pm
by chulett
If "evdate" is a job parameter in the Sequence job then you may need to encase it in hash marks '#' so it knows that.

Code: Select all

#evdate#[4,2] >= '02' and #evdate#[4,2] <= '05'
See if that helps at all.

Posted: Tue Jul 16, 2013 2:09 pm
by ray.wurlod
Not sure about the sharp signs. Use the Expression Editor to build your trigger expression, so that you can select the parameter name from a list.

Posted: Tue Jul 16, 2013 2:51 pm
by chulett
Me neither... hence the 'may' part. :wink:

Posted: Tue Jul 23, 2013 6:11 am
by arunkumarmm
If it is the same table you are using and just the different columns depending on the 'date' parameter, why dont you just pass this date to the job and use it in your source query? Why do you need two jobs?