multiple loops in a squence job..

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
jagadam
Premium Member
Premium Member
Posts: 107
Joined: Wed Jul 01, 2009 4:55 pm
Location: Phili

multiple loops in a squence job..

Post by jagadam »

Hi,

My requirement is to pass two sets of dates(as parameters) into the given sql queries.

I have created two jobs, one for each set of dates.

Iam trying call these two jobs thru a sqeunce job and pass the dates in the loops as list.

Here is my sequence flow.

execute stage1-->UserVariable1-->StartLoop1--->Jobactivity1-->executestage2-->UserVariable2-->Jobactivity2-->Jobactivity3-->Stoploop(1&2).

I want to pass for example two sets of parameters(2009-01-31,2009-02-28)and(Prev_yr_date1,Prev_yr_date2). I want the dates to be picked as "2009-01-31" in first loop "Prev_yr_date"1 in the second loop and run till jobactivity3 and then start again from startloop1 with 2009-02-28 in the first loop(ie jobactivity1) and pre_yr_date2 in the second loop(ie jobactivity2) and run till jobactivity3 and so on...
The issue is for the first comple run its picking the dates correctly (ie "2009-01-31" ,"Prev_yr_date1") but for the second run it picking the dates as "2009-02-28",Prev_yr_date1) ie startloop1 is picking the params fine but startloop2 is picking only the first parm..I could figure out where the prooblem is..

I tried to explain it as best as i can(i know that this is still not clear..but thought will give some idea atleast)
Any thoughts on this would be of grt help.

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

Post by chulett »

I'm a little lost as to what you want to do. You would use a loop inside a loop if you had something like two lists, say:

A,B,C,D
1,2,3,4

And you wanted to run this "Job3" 16 times, once around the inner loop for each item in the outer loop, like so:

A1,A2,A3,A4,B1,B2,B3,B4,C1 (etc)

However, I get the impression that's not what you're after from your description of the 'problem', that being the inner loop starting over from the beginning each time - exactly what it should be doing. Now, if what you actually want is to run the job four times, like:

A1,B2,C3,D4

You only need one loop and one UserVariable stage, which can track both lists and then you iterate through the linked lists simultaneously. I've got a post here showing how to do that, if that's what you need I'll dig it up.

Dug: viewtopic.php?t=127425
Last edited by chulett on Mon May 03, 2010 10:40 pm, edited 1 time in total.
-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 »

As I read the question, your outer loop processes a date, and the inner loop uses the outer loop's date as the previous date. Is this a correct reading?

Otherwise it's a single loop with multiple loop index variables which you could combine (as a delimited string) into a single loop index variable and parse when assigning parameter values to particular Job activities.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
jagadam
Premium Member
Premium Member
Posts: 107
Joined: Wed Jul 01, 2009 4:55 pm
Location: Phili

Post by jagadam »

Hi Craig,

I tried your method and it worked...Thanks!!!

Thanks.
NJ
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

8)
-craig

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