Need to use date to run certain jobs in a Sequence

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
raji33
Premium Member
Premium Member
Posts: 151
Joined: Thu Sep 23, 2010 9:21 pm
Location: NJ

Need to use date to run certain jobs in a Sequence

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
raji33
Premium Member
Premium Member
Posts: 151
Joined: Thu Sep 23, 2010 9:21 pm
Location: NJ

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

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

"You can never have too many knives" -- Logan Nine Fingers
raji33
Premium Member
Premium Member
Posts: 151
Joined: Thu Sep 23, 2010 9:21 pm
Location: NJ

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

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

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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Me neither... hence the 'may' part. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post 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?
Arun
Post Reply