Job Sequence trigger usage based on data value 0 or !=0

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

rcdhawan
Participant
Posts: 15
Joined: Wed Sep 12, 2007 7:04 pm

Job Sequence trigger usage based on data value 0 or !=0

Post by rcdhawan »

Hi All,

I have two parallel jobs. First job that returns 0 or !=0 value in the file. The second job creates a data file.

What I am looking is to put a job sequenece with the below logic:

If the output data value of first job is 0, run the second job otherwise send an email.

Please suggest how to write this logic in the job sequence.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Welcome aboard.

Run the first job. Then have an Execute Command activity read (cat) the file. Capture the output and extract the field containing the value in a custom trigger that determines whether the second job runs.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rcdhawan
Participant
Posts: 15
Joined: Wed Sep 12, 2007 7:04 pm

Post by rcdhawan »

Thanks Ray.

But is it possible to store the value in the variable in the first job and then use that in the cutom trigger of the activity job to run the second job or not.
ray.wurlod wrote:Welcome aboard.

Run the first job. Then have an Execute Command activity read (cat) the file. Capture the output and extract the field containing the value in a custom trigger that determines whe ...
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

In parallel jobs you don't have the facility to write a value to a variable like server jobs using $userstatus (If you search for 'setuserstatus' you can find more on this). What you can do is: write the value into a file and use an execute command stage to 'cat' this value and according to the return value of this stage trigger the next activity.
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>
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In short, the answer to the second question is "no".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rcdhawan
Participant
Posts: 15
Joined: Wed Sep 12, 2007 7:04 pm

Post by rcdhawan »

Thanks JoshGeorge and Ray!

ray.wurlod wrote:In short, the answer to the second question is "no". ...
rcdhawan
Participant
Posts: 15
Joined: Wed Sep 12, 2007 7:04 pm

Post by rcdhawan »

I have used the execute command activity to run the shell script like:

cat /user/local/tmp/count.txt

count.txt can have values of 1 or 0

Then I put two Return value conditional expression = 1
and Return value conditional expression = 0

But it never goes to this condition 1 ie when the value in the count.txt is 1
I open the count.txt file and do not see any spaces or blanks.

How to check this 1 or 0 condition? Am I missing something?

rcdhawan wrote:Thanks JoshGeorge and Ray!

ray.wurlod wrote:In short, the answer to the second question is "no". ...
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

If you are using cat then your checking conditions should be CommandOutput instead of ReturnValue
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Give that boy a cee-gar! :wink:

ReturnValue is the status of the command and zero indicates it ran without error. CommandOutput would capture whatever the command echo'd up on the screen / standard out - in this case your cat'd records.
-craig

"You can never have too many knives" -- Logan Nine Fingers
rcdhawan
Participant
Posts: 15
Joined: Wed Sep 12, 2007 7:04 pm

Post by rcdhawan »

Thanks. I will try this. Where can I find the documentation of these statuses? That will be helpful for me. Regards to everyone.
chulett wrote:Give that boy a cee-gar! :wink:

ReturnValue is the status of the command and zero indicates it ran without error. CommandOutput would capture whatever the command echo'd up on the screen / ...
rcdhawan
Participant
Posts: 15
Joined: Wed Sep 12, 2007 7:04 pm

Post by rcdhawan »

Thanks. I will try this. Where can I find the documentation of these statuses? That will be helpful for me. Regards to everyone.
chulett wrote:Give that boy a cee-gar! :wink:

ReturnValue is the status of the command and zero indicates it ran without error. CommandOutput would capture whatever the command echo'd up on the screen / ...
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That's just standard UNIX / shell stuff. Pretty much all you need to worry about there is zero = good, not zero = not so good. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
rcdhawan
Participant
Posts: 15
Joined: Wed Sep 12, 2007 7:04 pm

Post by rcdhawan »

This is the output that i see in Director: Note one space line after 1.
--------
Reply=0
Output from command ====>
1

------
And the Custom Conditional expression is:
Execute_Command_7.$CommandOutput=1

When I execute this never gets true to run the 2nd job. Please advice

chulett wrote:That's just standard UNIX / shell stuff. Pretty much all you need to worry about there is zero = good, not zero = not so good. :wink: ...
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Field marks in the output need to be removed. Your Custom Conditional expression should be:

Execute_Command_7.$CommandOutput<1>=1

-or-

EReplace(Execute_Command_7.$CommandOutput,@FM,"")=1
-craig

"You can never have too many knives" -- Logan Nine Fingers
rcdhawan
Participant
Posts: 15
Joined: Wed Sep 12, 2007 7:04 pm

Post by rcdhawan »

Craig, thank you. It worked!!
chulett wrote:Field marks in the output need to be removed. Your Custom Conditional expression should be:

Execute_Command_7.$CommandOutput<1>=1

-or-

EReplace(Execute_Command_7.$CommandOutput,@FM,"")=1
Post Reply