Switching between sequence and 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

mydsworld
Participant
Posts: 321
Joined: Thu Sep 07, 2006 3:55 am

Switching between sequence and job

Post by mydsworld »

I need to run a Job from sequence.Then inside the Job, I derive a few columns based on which I need to fire different jobs.

Can I set some User variable inside a job then access them from the sequence.How to do that ?
Minhajuddin
Participant
Posts: 467
Joined: Tue Mar 20, 2007 6:36 am
Location: Chennai
Contact:

Post by Minhajuddin »

When you say you want to start a job (say 'X') from a sequence(say 'Seq_A'). You can do this only when your job ('X') is a sequence. So, you can call a sequence or a job from a sequence. But, Datastage doesn't have any stage (in server or parallel edition) which will call a job from a Parallel/server job.
Minhajuddin

<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You need some way for the job to stash / land that data in such a way that the Sequence job can pick up and pass along. For a Server job I'd suggest USERSTATUS, however either job type can write data to a flat file and a Sequence routine can pick them up and pass them as job parameters to downstream jobs.
-craig

"You can never have too many knives" -- Logan Nine Fingers
mydsworld
Participant
Posts: 321
Joined: Thu Sep 07, 2006 3:55 am

Post by mydsworld »

If I use UserStatus inside Job,how to assign value to that inside the job.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Search the forums for USERSTATUS, it's all out there including some code that may come in handy.
-craig

"You can never have too many knives" -- Logan Nine Fingers
mydsworld
Participant
Posts: 321
Joined: Thu Sep 07, 2006 3:55 am

Post by mydsworld »

Here is my requirement :

I have a sequence MySeq that has job J1.

Now J1 produces N records (each containing say 5 columns)

Now based on each record column value, I need to call different jobs say J2,J3 etc in the sequence MySeq.

How to impplement that.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Off the top of my head, a routine to read those values in and a Nested Condition stage to split the flow from there to the right Job Activity. Perhaps all in a looping structure supported by a UserVariables Activity stage.
-craig

"You can never have too many knives" -- Logan Nine Fingers
mydsworld
Participant
Posts: 321
Joined: Thu Sep 07, 2006 3:55 am

Post by mydsworld »

How can we use Routine to read those values in. If I store the N rows into a database table (in job J1), will I be able to read those values using Routines from sequence.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Land them. A routine can then build the delimited list that the UserVariables and/or Start Loop stages are looking for. Perhaps by something as simple as cat'ing them to standard out and capturing that output. You could also use a function like Convert() to flatten the dynamic array into a comma delimited list. Many ways to skin this cat.
-craig

"You can never have too many knives" -- Logan Nine Fingers
mydsworld
Participant
Posts: 321
Joined: Thu Sep 07, 2006 3:55 am

Post by mydsworld »

Can we use USERSTATUS instead of Routine to capture the delimited values.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Yes.

You would need to parse them out of the $UserStatus activity variable, probably using Field() functions.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Minhajuddin
Participant
Posts: 467
Joined: Tue Mar 20, 2007 6:36 am
Location: Chennai
Contact:

Post by Minhajuddin »

mydsworld wrote:Here is my requirement :

I have a sequence MySeq that has job J1.

Now J1 produces N records (each containing say 5 columns)

Now based on each record column value, I need to call different jobs say J2,J3 etc in the sequence MySeq.

How to impplement that.
This seems simple to me, I hope I am not missing anything.
My assumption is that you would know beforehand what jobs J2,J3 .. are.

For now let's say that job J1 generates data which can be potentially be processed by jobs J2, J3, J4 (based on your column which decides the job)

Design your job J1 in such a way that it creates three datasets after passing the last output link through a transformer and then to three datasets(say J2.ds, J3,ds, J4.ds). These three links can be constrained in such a way that only the records that have to go to job J3 go to J3.ds. After this you just have to connect these four jobs through a sequence. You can trigger jobs J2,J3,J4 simultaneously after J1 finishes successfully.
Minhajuddin

<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

If you want to call different jobs from the current processing job (i.e. J1) try:

Server Job: Write a small routine which will just attach and run the job.
Parallel Job: Try External Filter with dsjob command or try a parallel routine.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

Post by ag_ram »

Minhajuddin wrote:For now let's say that job J1 generates data which can be potentially be processed by jobs J2, J3, J4 (based on your column which decides the job)

Design your job J1 in such a way that it creates three datasets after passing the last output link through a transformer and then to three datasets(say J2.ds, J3,ds, J4.ds). These three links can be constrained in such a way that only the records that have to go to job J3 go to J3.ds. After this you just have to connect these four jobs through a sequence. You can trigger jobs J2,J3,J4 simultaneously after J1 finishes successfully.
But i feel that this suggestion would result,

1. Unwanted creation of datasets. (in every run two unwanted datasets)
2. Unwanted execution of the rest of the Jobs.

I suppose that chulett had given enough solution for this problem.
Minhajuddin
Participant
Posts: 467
Joined: Tue Mar 20, 2007 6:36 am
Location: Chennai
Contact:

Post by Minhajuddin »

ag_ram wrote: But i feel that this suggestion would result,

1. Unwanted creation of datasets. (in every run two unwanted datasets)
2. Unwanted execution of the rest of the Jobs.

I suppose that chulett had given enough solution for this problem.
I don't know about others, But, If I find a simple way to solve a problem, I would rather go with that solution instead of using a Rube Goldberg kind of solution. Moreover the OP has not mentioned that the data to be processed is mutually exclusive.
Minhajuddin

<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
Post Reply