Conditional execution

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
kishorenvkb
Participant
Posts: 54
Joined: Mon Dec 24, 2007 9:27 am

Conditional execution

Post by kishorenvkb »

Hello,

In a sequence I have an execute command which calls a bteq to populate a table. Upon successful... the sequence continues to executes the next stage, which is a datastage job that joins the table that is populated in the previous stage with another huge fact table.

Most of the time the first table that is populated will not have any rows. If there are no rows in this table, there is no need to execute the next stage (calls a ds job) to join the huge fact table to this empty table.

How can I avoid doing this? Basically, I want to continue to the next stage in the sequence, if there exists data in the table that I just populated.

Thanks
Minhajuddin
Participant
Posts: 467
Joined: Tue Mar 20, 2007 6:36 am
Location: Chennai
Contact:

Post by Minhajuddin »

>You would have to get the count of records from your table somehow (Maybe create another job which gets the count)
>Read the count from the file which you created (You can do this using a small basic routine or by using an execute command activity)
>Branch using a conditional activity based on the output from the previous stage
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>
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Re: Conditional execution

Post by priyadarshikunal »

kishorenvkb wrote:Hello,

In a sequence I have an execute command which calls a bteq to populate a table. Upon successful... the sequence continues to executes the next stage, which is a datastage job that joins the table that is populated in the previous stage with another huge fact table.

Most of the time the first table that is populated will not have any rows. If there are no rows in this table, there is no need to execute the next stage (calls a ds job) to join the huge fact table to this empty table.

How can I avoid doing this? Basically, I want to continue to the next stage in the sequence, if there exists data in the table that I just populated.

Thanks

You have to many options
here are the two options

1. Get row count from the links
2. Count the number of rows in the table

and and don't forget to store it some where probably environment variable or user variable.
and on the basis of that you can trigger the job.
For more details on these options, search forum.

one more option is to wait for kim to see this message :wink:

Regards,
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
kishorenvkb
Participant
Posts: 54
Joined: Mon Dec 24, 2007 9:27 am

Post by kishorenvkb »

You are right on the money. Yes, I need to have the count of rows in a table available in a sequence.
I have written the count to a text file.
The challenge is how to read the text file and get the count available in the sequence for me to perform a conditional branching of jobs.

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

Post by chulett »

If you've got a simple count in a text file, you can easily build a routine to 'cat' the file and then capture the result. You can then branch based on that result.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kishorenvkb
Participant
Posts: 54
Joined: Mon Dec 24, 2007 9:27 am

Post by kishorenvkb »

Thanks a bunch. It worked.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Please mark the thread as Resolved.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
manuel.gomez
Premium Member
Premium Member
Posts: 291
Joined: Wed Sep 26, 2007 11:23 am
Location: Madrid, Spain

Post by manuel.gomez »

chulett wrote:If you've got a simple count in a text file, you can easily build a routine to 'cat' the file and then capture the result. You can then branch based on that result.
how can we do this in Windows? I do have exactly the same problem
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The same way. The MKS Toolkit will have a 'cat' command, I assume, or you can use the DOS command 'type' which will accomplish the same thing.
-craig

"You can never have too many knives" -- Logan Nine Fingers
manuel.gomez
Premium Member
Premium Member
Posts: 291
Joined: Wed Sep 26, 2007 11:23 am
Location: Madrid, Spain

Post by manuel.gomez »

chulett wrote:The same way. The MKS Toolkit will have a 'cat' command, I assume, or you can use the DOS command 'type' which will accomplish the same thing.
True, sorry for asking!
manuel.gomez
Premium Member
Premium Member
Posts: 291
Joined: Wed Sep 26, 2007 11:23 am
Location: Madrid, Spain

Post by manuel.gomez »

chulett wrote:The same way. The MKS Toolkit will have a 'cat' command, I assume, or you can use the DOS command 'type' which will accomplish the same thing.
True, sorry for asking!
Post Reply